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.
Wrote a 3rd solution that includes a
combine
function and it improves readability when I compared with my 2nd solution.Cheers ;-)
This comment is hidden because it contains spoiler information about the solution
Unfortunately, I cannot edit the tests any more, as too many people have completed this kata.
Test.randomize()
is part of the test quite built-in to Codewars. It randomizes the order of the given array.Infinity
should be AN, I think. The idea is to make sure the value is a number of some kind, soInfinity
should be allowed. As I said, I cannot add this in, but that's a good idea, nonetheless.I find the test case difficult to read and understand. As a rule of thumb I try to make my tests as simple as possible in order to avoid false positive/negative.
Wouldn't the following tests achieve the same thing?
Also I can't see a test for
Infinity
. I've seen solutions usingwindow.isFinite()
to exclude such number.Having said that what I thought would be quite straightforward turned out to be a bit trickier. So thanks for that!