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.
this is the most obvious solution but not the best algorithm.
This comment is hidden because it contains spoiler information about the solution
Nice solution! Please check my (small) stylistic improvement for this solution - https://www.codewars.com/kumite/577ced176a3c22db770000a8?sel=5a37566b1f7f7095aa000088
I see this as the best voted solution but I have also heard mention to avoid for loops in Ruby. Is there any merit to this statement or is this a particularly relevant use case?
Since groups are always very small, and both 2*n and n is O(n) there is no real reson for that kind of optimization unless you are really hurting for more perfomance.
love this. nice job.
The requirements for the first function was somehow hard to get.
This comment is hidden because it contains spoiler information about the solution
NaN
propagation trick is fucking neat.It does not work for iterators, e.g. is_monotone(n for n in range(10)) returns False.