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.
The reference solution contains "invalid" JS code.
Done
Test.assertDeepEquals
should be used, or better Node 10 + chai.The tests are creating global variables.
The tests should not print anything intrusively.
The user can modify the input.
I will do it in python
python translation:
https://www.codewars.com/kumite/5e96f0ff481bf600241dca33?sel=5e96f0ff481bf600241dca33
situations where both price and dist are equal can still happen in the random tests. Would be better to actually specify the behavior and test for it.
I met this situtation today. (There were two destination with same dist/prices.)
Nice story. But it's still the umpteenth duplicate of "sort this list".
Thank you for bringing this up. I've made changes in both the solution and random tests to account for this.
Sample tests missed.
What if both
dist
andprice
are equal?Random tests sometimes will generate such test cases.