C one line solution


  • 0
    bool isPowerOfThree(int n) {
        return n<=0?false:(!((int)pow(3,(int)(log10(0x7fffffff)/log10(3)))%n));
    }
    

Log in to reply
 

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