Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Cannot pass it on PHP.

    Strangely, random test passes OK, but testBasic fails.

    Moreover, in testBasic code I see only two tests, but when running there are three. I dumped arrays and cannot find the issue.

    Time: 405ms Passed: 1 Failed: 1
    Test Results:
    AreTheyTheSameTestCases
    testBasics
    Log
    Array
    (
    [0] => 121
    [1] => 361
    [2] => 361
    [3] => 361
    [4] => 14641
    [5] => 20736
    [6] => 20736
    [7] => 25921
    )
    Array
    (
    [0] => 121
    [1] => 361
    [2] => 361
    [3] => 361
    [4] => 14641
    [5] => 20736
    [6] => 20736
    [7] => 25921
    )
    1Array
    (
    [0] => 121
    [1] => 361
    [2] => 361
    [3] => 361
    [4] => 14641
    [5] => 20736
    [6] => 20736
    [7] => 25921
    )
    Array
    (
    [0] => 231
    [1] => 361
    [2] => 361
    [3] => 361
    [4] => 14641
    [5] => 20736
    [6] => 20736
    [7] => 25921
    )
    Array
    (
    [0] => 121
    [1] => 361
    [2] => 361
    [3] => 361
    [4] => 14641
    [5] => 20736
    [6] => 20736
    [7] => 25921
    )
    Array
    (
    [0] => 121
    [1] => 361
    [2] => 361
    [3] => 14641
    [4] => 20736
    [5] => 20736
    [6] => 25921
    [7] => 36100
    )
    ✘ Failed asserting that false matches expected true.
    Completed in 0.29ms
    testRandom (1 Passed, 0 Failed)

  • Custom User Avatar

    Bad solution, but looks elegant. Good solution requires two array iterations.