Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/codedecks-in/LeetCode-Solutions
/ isPowerOfThree
Method
isPowerOfThree
Java/Power-of-Three.java:2–14 ·
view source on GitHub ↗
(int n)
Source
from the content-addressed store, hash-verified
1
class
Solution {
2
public
boolean isPowerOfThree(
int
n) {
3
4
if
(n < 1)
5
{
6
return
false;
7
}
8
9
while
(n % 3 == 0)
10
{
11
n = n/3;
12
}
13
return
n==1;
14
}
15
}
Callers
nothing calls this directly
Calls
no outgoing calls
Tested by
no test coverage detected