Convert the integer to a binary string. From the right (that is least significant bit), find the first occurence of 01 in the string. For example.. if the string is *00110 **01 **11100*, notice the isolated part, that is what you have to find. Then simply flip the 01 to 10.. like *00110* *10**11100.* And then move all the 1's that you skipped to the right.. like *00110**10**00111*
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@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.