IBM Interview Question

Write a function that accepts an integer and returns a boolean which will be true when the given number is a power of 2.

Interview Answer

Anonymous

Apr 7, 2019

x&(x-1) should do it if number is not 0