can u explain how this formula is working plz
I'm not able to understant this problem
@prjbatra084, so the answer should be log2( N & -N ) + 1 , let me explain how ,if n is a positive number , so -n will be a negetive number and negetive number are represented in 2’s compliment ,which is ~n+1 , ~n has all the bits of n inverted due to which we get 0 in place of 1 and vice versa so when we add 1 to ~n then that 1 occupies the first rightmost 0 in (~n)(which is same as rightmost 1 value in n) and other bits have inverted values or zero values . so when we perform & operation we get only rightmost bit set in the function ,and then we perform logn (base2) to get corresponding index.
eg :- n = 1110010100
~n= 0001101011
~n+1=-n= 0001101100
(n&(-n))= 0000000100 = 4
log(4) =2
2+1=3 which is the answer
you should try applying the formula on some examples on your own for better clarity
In case of any doubt feel free to ask 
Mark your doubt as RESOLVED if you got the answer