Ad
  • Custom User Avatar

    I think it might have something to do with the fact that the same array is used for both "sides" of the test.

    Here's the breakdown (possibly):

    Test.assertSimilar(sortReindeer(testArray), solution(testArray));

    So first, do the user's sort on the array, which returns a reference to the array. Then sort using the test's solution, which also returns a reference to the same array. So the code becomes equivalent to:

    sortReindeer(testArray);
    solution(testArray);
    Test.assertSimilar(testArray, testArray);
    

    So I guess anything that returns the original array would pass this test? Maybe?

  • Default User Avatar

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