Ad
  • Custom User Avatar

    Tests updated.

  • Custom User Avatar

    Also, it should be rewritten to be more consistent with numbers versus integers.

  • Custom User Avatar

    I saw some of the "correct anwsers" and they should not be accepted.
    Please, someone write this test:

      Test.assertEquals(cubeOdd(["12","9"]), undefined);
    

    Edit:

    This chanllenge needs to be rewriten if you really want to return undefined if any of the values aren't numbers.

  • Custom User Avatar

    That was a little tricky one. I had to scratch my head for a while to find a solution. I'll made a suggestion for the newcomers read the intsructions carefully.

  • Custom User Avatar

    This depends a lot on the definition of "power of two" you establish. We could be allowing rational exponents (square roots). Even Integer exponents would start a painful process as 2^(-2) (1/4) would be a valid parameter. With the same rules we could say that exponents are only Natural, then 1 would not be a power of two.

    I take your point and very much agree that we should definitely define the Range of exponents we are taking into account.

  • Custom User Avatar

    There's a bug in the test cases and width the biwised solutions. 0 is not a power of two cause any number powered to 0 equals 1, so there should be two mandatory tests:

    Test.assertEquals(isPowerOfTwo(0), false);
    Test.assertEquals(isPowerOfTwo(1), true);