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.
Well, that's after I changed this:
For this:
Any idea why the first one gave that error instead of the out of bounds? I mean, hiding the real problem.
As it says, one of the arguments of the
+
inside the innerloop
isnil
, which means the index is out of bounds.I saw it, but still I have no idea why that happens, sorry. Maybe someone who's more fluent in Ruby could find out why.
I'm gonna explain why that happens (I hope), but that part of the code should run only if your function isn't called
two_sum
.And it's there for compatibility reasons. The Ruby translation used camelCase instead of snake_case at first and then that was changed. No idea why it would pass some tests and fail randomly. It doesn't happen with my solution.
It's not that test you are failing but the previous one. Print the input at the beginning of your code.