Wrong testcase (for number 9 - output should be false as it is not a cube of any integer number)


  • -2
    R

    public static boolean isPowerOfThree(int n) {
    float num1 = (float)Math.log10(n);
    float num2 = (num1/3);
    float num3 = (float)Math.pow(10,num2 );
    boolean result = false;
    System.out.println(num3);
    if (num3 ==(int)num3){
    System.out.println("Cube");
    result = true;
    }
    return result;
    }


  • 1
    H

    dude 9 = 3^2 , it is not asking for cubes. It is asking if y = 3^x


  • 0
    R

    Thanks for correcting me


Log in to reply
 

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