So strange! Can anyone help explain this?

  • -1

    Yeah, sure, this question is simple as it is.
    But when I submit my code using:
    public boolean isPowerOfThree(int n) {
    double f = Math.log(n)/Math.log(3);
    return ((f-Math.floor(f))==0)?true:false;
    This code can't pass all test cases such as 243.
    But when I change function 'log' with 'log10', it was accepted !
    What the hell is this?

Log in to reply

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