Ad
  • Default User Avatar

    Submitted this same solution and it didn't work.

  • Custom User Avatar

    Hi muges,

    Sorry, missed you reply.
    I've found an issue, I've forgotten to clone the tested array for actual and expected methods.
    It's not needed for other languages because expected method is executed first.
    But for JS it differs. Assert.equals(actual, expected) - actual ans expected are swapped.

    Unfortunately I can't change my tests as it's blocked by the site once more then 1000 users pass it.
    But you can change your solution by adding a = a.slice(0) to the first line of your method.

    Thanks for spotting it.
    ~Cheers

  • Custom User Avatar

    Hi muges,

    I aggree that all provided by you array should return 1, 2, 2 accordingly,
    But I've double cheked the code and didn't find any issues.
    js tests show results in the next format: Expected: 7, instead got: 1 and you can't actually see the tested array of input/random data.
    If you want you can provide me your solution (marked spoiler) and I can check it too.

  • Default User Avatar

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