Ad
  • Custom User Avatar
    PASSED!
    expected: ['', '', '', '', '', '', '73', '', '', '', '141']
    got:      ['', '', '', '', '', '', '73', '', '', '', '141']
    

    Tests should not print anything on success.

  • Custom User Avatar
    FAILED :-(
    expected: ['', '', '', '', '', '', '73', '', '', '', '141']
    got:      ['', '', '', '', '', '', '0', '', '', '', '0']
    

    The tests should only compare values returned by top, and do everything explicitly, instead of relying on some hidden function.

  • Custom User Avatar

    Node 12 should be enabled, and class syntax should be used.

  • Custom User Avatar

    Input: ["Leaderboard","addScore","addScore","addScore","addScore","addScore","top","reset","reset","addScore","top"] [[],[1,73],[2,56],[3,39],[4,51],[5,4],[1],[1],[2],[2,51],[3]]
    Output: [null,null,null,null,null,null,73,null,null,null,141]

    These input/output has nothing to do with the task.

  • Custom User Avatar

    The tests are easily cheatable.

  • Default User Avatar

    The same problem on LeetCode. Did you get permission to reproduce it here?

  • Custom User Avatar

    No random tests.

  • Custom User Avatar

    You could try writing a translation of the kata raulbc777 mentioned, there is small difference tho, the array size is fixed in the other kata.

    There are some other problems with yours

    • No random tests (this is an issue)
    • Your solution mutates the input, so when evaluating the user's answer, if you use the same array, if you create the expected value first, you'll be giving the user a sorted array. There are two ways of solving that problem, change your solution so it doesn't mutate the input and calculate the expected result before the array is passed to the users' function, or pass the user's function a shallow copy and calculate the expected value after that. Mutating the input is a bad practice.
  • Custom User Avatar