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.
Changing
Array#include
is not an ideal solution as it may break other code if thrown into a more complex program.Superb!
It looks like you did :)
+1 for the Wikipedia-link. Of course there's a Wikipedia page for this type of problem. After reading, it looks like I implemented Brent's algorithm. :)
This is a really cool solution. Although you did pass the tests, you are still not able to spend more then one coin. Awesome!
I agree with Ibriais, but still, this is a pretty clever solution :).
It's an implementation of the "tortoise and hare" algorithm, by Robert W. Floyd. I used the version published in wikipedia, but I find this one to be more straight-forward since it only takes care of finding the loop size, which is exactly what the problem needs.