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.
JS :
Nice tip. I've marked your comment as a spoiler (since it contains your solution).
FYI, comments (including ones that are posted in the solutions section of a kata) are exposed to everyone (including those who haven't solved the kata, yet) so it's best to mark anything containing spoilers with the
Spoiler
tag. This way, only those who have solved the kata will be able to view your comment.This comment is hidden because it contains spoiler information about the solution
Why not
===
?Forgot about bind, good one...
I did something like this and it kept giving me errors... happy to know i was on the right track...
This comment is hidden because it contains spoiler information about the solution
I've noticed that several of the accepted solutions work only for max two passes. They are accepted because all unit tests for the solution have cases that indeed require only 2 passes. However, it is possible that calculating the result may require three passes (e.g. for Sep 29 1999). I think such case should be added to the test suite for this kata, to catch invalid, hardcoded solutions.
This solution is invalid - it assumes there are at max two steps.
In the case of Sep 29 1999 there will be 3 steps:
1.) 9 + 2 + 9 + 1 + 9 + 9 + 9 = 48
2.) 4 + 8 = 12
3.) 1 + 2 = 3
Maybe such edge case should be added to this kata unit tests?