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.
Could someone here easily fix that?
That's a good idea. I'll add it.
I'm glad you were able to solve it!
First, I didn't realize this was coffeescript you were failing on, in case that matters.
I just tested it under coffeescript, with my solution but adding your
if
block to the top. It consistently finishes within a second or two, both under "My Test Fixtures" and when submitting the code. I have never had a time out. It's not my kata or tests.Can you reproduce the timeout if you only have the
if
block in your function? In other words, if this is all that you submit:If that works consistently (ie: the first test passes every time), then the error still must be within your code somewhere.
Sorry, I don't know what else to suggest. :-\
I just tested it, it worked fine for me. Simply throwing this into the top of Your Test Fixtures should show this:
I tested it against my code several times, and had no timeouts. My guess is that it's just a coincidence.
If you are still having issues, then most likely your algorithm has something that's getting stuck in an infinite loop. One thing that might help is to add a counter to one or more of your loops, and break out if the counter exceeds some rational number, like 50. You can then use
console.log()
to check on your variables and see if something is getting stuck.