본문 바로가기

Problem Solving/리트코드(leetcode)

Power of Four

class Solution {
public:
    bool isPowerOfFour(int n) {
        if(n == 0) return false;
        if(ceil(log(n) / log(4)) == floor(log(n) / log(4))) return true;
        else return false;
    }
};

'Problem Solving > 리트코드(leetcode)' 카테고리의 다른 글

Sqrt(x)  (0) 2022.01.16
Self Dividing Numbers  (0) 2022.01.16
Lemonade Change  (0) 2022.01.16
Add Digits  (0) 2022.01.16
Summary Ranges  (0) 2022.01.16