image_2021-12-22_03-19-23.png
23.8 KB
#N231. Power of Two
problem link
#solution
problem link
#solution
class Solution {
public boolean isPowerOfTwo(int n) {
if(n<1) return false;
if(n==1) return true;
if(n%2==0) return isPowerOfTwo(n/2);
return false;
}
}👍2