Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Also, there are method to copy the whole object.
And also, that's not actually an issue.
Sorting the array is a very inefficient way of solving the problem. Folks in the comments pointed out that sorting takes O(n log n) time. The better solution takes O(n) time.
someone please tell me why test fail?
Time: 382ms Passed: 10 Failed: 100
should work for basic tests (5 Passed, 0 Failed)
should work for more fixed tests as well (5 Passed, 0 Failed)
should finally work for random tests
✘ Expected: 72, instead got: 61
✘ Expected: 90, instead got: 34
✘ Expected: 150, instead got: 94
✘ Expected: 79, instead got: 17
✘ Expected: 31, instead got: 8
✘ Expected: 96, instead got: 45
✘ Expected: 72, instead got: 53
✘ Expected: 157, instead got: 110
✘ ...
"Hint: Do not modify the original array."
What? Array is an object and copying it to the new array just copy the link, so sorting a new array is modify original array. So what was meant in that hint?