logic: N=3.. k=5th(position).....length...
no. of setbit :0... 000 k =5 no. of setbit :1.. on every loop get next number of same number of bits and decrement k by 1..... 001 k = 4 010 k=3 100 k= 2 no. of setbit: 2 011 k=1.. 101 110 Therefore answer is 011 complexity : O(n)... With regards, Praveen Raj DCE-IT 9999735993 [email protected] -- 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.
