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.
I agree with you. This is more like a clever solution than best practice.
Most of the people who write the solution in a 8kyu kata are new programmers, many of them don't even know what O notation is, I guess it's the highest ranked because it's easy to understand and easy to think about it. Kata tests do not measure performance, so it is not a flag. I agree with the down buttons. but i think that the kata tests will have any performance input like a lot of inputs or timing. I submit the sort version to, because is the faster way to write the solution, are only to instructions.
Agree. I wish there were down votes too. It may be missleading especially for novice programmers.
Why is this a best practice? Sorting complexity for sorting is about and is O(n * log(n)) and just iterating through the array will take O(n) that faster and simplier, e.g. for 1 billion array list the number of iteration for sorting will be about 30 billions.
array_slice good decision. I forgot about it)
Test.assertEquals(solution(new Date('01/02/2008')), 4, '01/02/2008') should expect 5 not 4 (1 + 2 + 2). Am I right?