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.
There are a total of 6 fixed test cases and 100 test cases where the distance for each lap is randomly taken from [1, 10000]. In case this is not a codewars problem, you might want to think again about your implementation and maybe come up with a faster solution that does less iterations.
The description isn't vague, you might just not understand it. Try to train on easier katas first to gain more experience and then challenge yourself again on this hard kata when you are ready for it.
Arguably, this is a duplicate of http://www.codewars.com/dojo/katas/5274d9d3ebc3030802000165 although it is not immediately obvious that you have to implement lcm() for the other kata, which only adds to the challenge.
This comment is hidden because it contains spoiler information about the solution
new solution:
As long as the following works, the kata is not ready for prime-time:
Only algorithm so far with linear time :)
The instructions should definitely mention something about requiring to implement a getter. Even better would be to have the example in the description use the getter as well.
You might want to specify that the first dimension of the input array contains the rows and the second dimension contains the cols. Like input[row][col]. This is not immediately obvious and needs to be deduced from the structure of the expected result.
MAGIC!
11 upvotes, no negative comments, not totally obvious 5 kyu kata ... when is this going out of beta ? :)
If you feel that an answer was helpful, feel free to upvote that answer :)
This comment is hidden because it contains spoiler information about the solution
forkmonkey: his solution is short, I give him that. But it is in no way fast, especially since he has to reverse() twice in one pass. Please refer to http://jsperf.com/codewars-snail to see actual data on medium sized arrays. Differences will increase drastically if larger arrays are used.
It might be beautiful, but an algorithmic nightmare :)
Loading more items...