Please correct. ans = (x|7)+1.
Thanks Dave. On Mon, Sep 27, 2010 at 5:42 PM, saurabh agrawal <[email protected]>wrote: > This problem is already solved. > ans=(x|1)+1 > > > On Mon, Sep 27, 2010 at 5:15 PM, nishaanth <[email protected]> wrote: > >> try x+8-(x&7 ) >> >> On Sep 26, 4:47 am, Dave <[email protected]> wrote: >> > @Shrevan: I mistyped what I intended. Try answer = (x | 7) + 1; >> > >> > Dave >> > >> > On Sep 26, 5:51 am, Shravan <[email protected]> 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 <[email protected]> wrote: >> > >> > > > sry...i dnt get the qstn clearly..... >> > >> > > > On Sat, Sep 25, 2010 at 10:18 PM, Dave <[email protected]> >> wrote: >> > > > > Simpler: answer = (x || 7) + 1 >> > >> > > > > Dave >> > >> > > > > On Sep 25, 10:14 am, rajess <[email protected]> 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 [email protected]. >> > > > > To unsubscribe from this group, send email to >> > > > > [email protected]<algogeeks%[email protected]> >> <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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<algogeeks%[email protected]> >> . >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
