We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 078ef54 + b3cea90 commit a457c11Copy full SHA for a457c11
326. Power of Three
@@ -0,0 +1,8 @@
1
+class Solution {
2
+public:
3
+ bool isPowerOfThree(int n) {
4
+ int e = log(INT_MAX) / log(3);
5
+ int N = pow(3, e);
6
+ return n > 0 && N % n == 0;
7
+ }
8
+};
0 commit comments