Leetcode 326 Solution

This article provides solution to leetcode question 326 (power-of-three)

https://leetcode.com/problems/power-of-three

Solution

class Solution {
public:
    bool isPowerOfThree(int n) {
        if (n <= 0)
            return false;

        return 1162261467 % n == 0;
    }
};