Please correct.

ans = (x|7)+1.

Thanks Dave.

On Mon, Sep 27, 2010 at 5:42 PM, saurabh agrawal <saurabh...@gmail.com>wrote:

> This problem is already solved.
> ans=(x|1)+1
>
>
> On Mon, Sep 27, 2010 at 5:15 PM, nishaanth <nishaant...@gmail.com> wrote:
>
>> try x+8-(x&7 )
>>
>> On Sep 26, 4:47 am, Dave <dave_and_da...@juno.com> wrote:
>> > @Shrevan: I mistyped what I intended. Try answer = (x | 7) + 1;
>> >
>> > Dave
>> >
>> > On Sep 26, 5:51 am, Shravan <shravann1...@gmail.com> wrote:
>> >
>> > > @Dave
>> > > Your answer will be always 2 irrespective of the value of 'x'.
>> > > BTW I too didn't the question.
>> >
>> > > On Sep 26, 2:42 pm, Mahendran MaheM <mehamind...@gmail.com> wrote:
>> >
>> > > > sry...i dnt get the qstn clearly.....
>> >
>> > > > On Sat, Sep 25, 2010 at 10:18 PM, Dave <dave_and_da...@juno.com>
>> wrote:
>> > > > > Simpler: answer = (x || 7) + 1
>> >
>> > > > > Dave
>> >
>> > > > > On Sep 25, 10:14 am, rajess <rajess1...@yahoo.com> wrote:
>> > > > > > scan last(left) 4 bits .if the bits are not 1000.make them
>> 1000.else
>> > > > > > scan from left till u find first one(1).make this bit 1.and make
>> > > > > > last(left) bits as 1000
>> >
>> > > > > --
>> > > > > You received this message because you are subscribed to the Google
>> Groups
>> > > > > "Algorithm Geeks" group.
>> > > > > To post to this group, send email to algoge...@googlegroups.com.
>> > > > > To unsubscribe from this group, send email to
>> > > > > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> <algogeeks%2bunsubscr...@googlegroups .com>
>> > > > > .
>> > > > > For more options, visit this group at
>> > > > >http://groups.google.com/group/algogeeks?hl=en.
>> >
>> > > > --
>> > > > MAHEM- Hide quoted text -
>> >
>> > > - Show quoted text -
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to