clueless coding // TODO: be smarter

LeetCode Power of Two: CPP Solution



TL;DR Code Solution


    bool isPowerOfTwo(int n) {

        if(n==0) return false;
while(n%2==0) n/=2;
return (n==1);

    }