Read the string backwards and print the same character till you find a 1.
Flip all the preceding bits.
E.g - 10 -> 10
11 -> 01 (LSB 1 is printed same, and the previous bit is flipped)
On Thursday, October 25, 2012 6:11:09 PM UTC-4, rahul sharma wrote:
>
> Plz give a program for this...thnx
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/GBNCJUxaFs4J.
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.