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.
That's because (in Ruby and many other languages) you can use an integer to get to the n-th charactetr in a String just as you can get the n-th element of an Array.
You can think of a String as an ordered list of charscters (technically code points, but thats another story).
why don't we need to turn em into arrays ?
Ahh that makes sense, thanks!
This comment is hidden because it contains spoiler information about the solution
Neat!
This comment is hidden because it contains spoiler information about the solution
What about conditions for gandicap? I should be -2 < gandicap < +26. This solution doesn't consider all kata's conditions
So cool!
This comment is hidden because it contains spoiler information about the solution
Well, I mean, the instructions say to return a variable 'l', and it's part of the code that's automatically put into the solution. I know my comment seems pedantic, but that wasn't my intention. I really do think this is the best answer, just that it doesn't follow that specific instruction.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Wouldn't want to run this simple categorisation against a database of millions! Object instantiation for each comparison of 2 intgers?
That may be better for more expensive calculations, but the beauty of this design is that it mostly doesn't matter. That change could be entirely internal to the class, with no change to the external interface. So... we don't have to make any decision about it until we've tested the performance.
I know this is done this way because the comparison is super basic... But what if "category" was expensive to calculate? Shouldn't it be stored inside the object? Created in initialize and refreshed everytime an attribute's setter is called.
Loading more items...