Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

public boolean isPowerOfThree(int n) { while(n>=1){ if(n==1) return true; int last_digit = n%10; if((last_digit!=1 && last_digit!=3 && last_digit!=7 && last_digit!=9) || n%3!=0) return false; else n/=3; } return n>0?true:false; }

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.