DEV Community

Discussion on: Power of 2, solving a google interview question. Playing with bits.

Collapse
 
akhilpokle profile image
Akhil

Yep, it one of the solutions, you're in right direction now combine the solution of the original question with this.

hint : if n&n-1 = 0, it means that the rest of the bit is guaranteed set to 0, so no need to parse them.