TheAlgorithms-C/leetcode/src/231.c
Evandro Nakayama Mota 8f0602c9f1 Add LeetCode 231
2019-10-28 17:06:18 -03:00

5 lines
104 B
C

bool isPowerOfTwo(int n){
if (! n) return false;
while (n % 2 == 0) n /= 2;
return n == 1;
}