Ad
  • Default User Avatar

    Initial Test was of the form Test.assertEquals(liftoff(arr), solution(arr)), arr being an array of random number of numbers in random order, liftoff the solution user submit and solution the test solution solving the kata.

    Then,... if arr was modified by the liftoff function, the result of solution may be not the expected one.

    For now, the test is modified to Test.assertEquals(liftoff(arr), res), res being result of solution(arr) computed before arr is passed to the liftoff function.

    That's why your solution now passes.

  • Custom User Avatar

    I think it would be safe to assume I can do what I want with the variable inside my own function.

    Arrays and other objects are referenced not copied into functions. Your actual submitted versions works since you don't add additional values to the array (no .push()).

  • Custom User Avatar

    You modify the instructions. Don't. The original author expects your function to be pure.

  • Default User Avatar

    I really don't understand where this "liftoff!" prefix come from.

    Here an example of what should (normaly) occurs:

    test some random arrays
    > [ 8, 1, 3, 4, 13, 6, 7, 10, 9, 2, 5, 12, 11, 14, 15 ]
    Test Passed: Value == 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 liftoff!
    > [ 2, 3, 1, 4, 8, 5, 7, 6 ]
    Test Passed: Value == 8 7 6 5 4 3 2 1 liftoff!
    ...
    

    Can you please post your code and mark it as spoiler ?
    (you'll don't see it no more but warriors who solved the kata will can)

  • Custom User Avatar

    It isn't. Do you modify the array?

  • Default User Avatar

    What's the error message please ?