Objective: Given a number, write and algorithm to find the right most set bit in it (In binary representation).
If N is a number then the expression below will give the right most set bit.
If we subtract 1 from the number, it will be subtracted from the right most set bit and that bit will be become 0.
So if we negate the remaining number from step above then that bit will become 1.
Now N & ~(N-1) will make all the bits 0 but the right most set bit of a number.
256 queries in 0.124 seconds.