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 comment is hidden because it contains spoiler information about the solution
This is beautiful and would be greatly improved if it was production code with one comment.
Here's why: the code would be broken if at ANY point any of the 'subtraction' tokens came before the un-modified token.
What I mean is: if C was listed in the hash before CM, or I before IV, and so on.
In fact, this code also relies on the fact that Ruby maintains hash order, but that is not strictly guaranteed by MRI. However, in practice I don't think anyone runs into hash order being a problem.
No, my main concern was that there should be a comment to the effect "Make sure subtraction tokens are listed before un-modified tokens (e.g. C before CM, I before IV)".
I'm not sure this solution even works.. there are more subtraction going on than described.. and why would you go through every edge case instead of applying some logic of addition and subtraction?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Could you/someone explain how this works?
Reduce would be cleaner.
I think this solution is the easiest to read and understand.
Brilliant! But this regex does not detect words ending with "'". e.g. "Louis'"
Ha, didn't know about this. Great solution!
Don't feel bad :)
Agreed. I did it hardcoded, too, but then felt bad about it!
I belive this shouldn't pass because it sums all values of keys :a, :b hardcoded, not the values of two passed keys to the function. Perhaps the Kata Test Cases should be improved?
this is neat :)
Great solution!
Loading more items...