1
class Solution {
2
public boolean isPowerOfTwo(int n) {
3
return power2(0, n);
4
}
5

6
public boolean power2(int index, int n) {
7
if (Math.pow(2, index) == n) return true;
8
if (Math.pow(2, index) > n) return false;
9
return power2(index + 1, n);
10
}
11
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0