Ad
  • Default User Avatar

    Description Suggestion JavaScript
    If the input array contains anything other than integers, then return undefined.
    Iterate through the array cubing each element meaning e3 or e*e*e.
    Grab only the odd cubed elements and return the sum.

  • Default User Avatar

    Find the sum of the odd numbers within an array, after cubing the initial integers

    but

    The function should return undefined/None/nil/NULL if any of the values aren't numbers

    so, what if number is float (not equal to its integer part)? It is a number, but it is not an odd number (even or odd are defined only for integer)
    Seems like, text might be
    "The function should return undefined/None/nil/NULL if any of the values aren't integers"
    and there must be any test with float (at least there are none of those in python version)

  • Custom User Avatar

    y, errors in test:
    assertEquals(0, FindOddCubes.cubeOdd(new int[] {-3, -2, 2, 3})); Must be -19(-3^3+2^2=-19, not 0); expected:<0> but was:<-19>

  • Default User Avatar

    Maybe it's just me, but I found the wording "the odd numbers" confusing. I thought it meant the odd array entries (ie the 1st, 3rd, etc). It was even more confusing because the first test case gives the same answer. Maybe shuffle the the numbers in the first test case, or make it clear you mean the numbers that are odd.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default 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.