diff --git a/326. Power of Three b/326. Power of Three new file mode 100644 index 0000000..a0f0139 --- /dev/null +++ b/326. Power of Three @@ -0,0 +1,8 @@ +class Solution { +public: + bool isPowerOfThree(int n) { + int e = log(INT_MAX) / log(3); + int N = pow(3, e); + return n > 0 && N % n == 0; + } +};