LeetCode #1780

Check if Number is a Sum of Powers of Three

1개의 풀이 · C++

문제 원문 보기 ↗

SOLUTION INFO

C++ · main.cpp

main.cpp
class Solution {
public:
    bool checkPowersOfThree(int n) {
        while(n) {
            int cur = n % 3;
            if(cur == 2) return false;
            n /= 3;
        }
        return true;
    }
};

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.