You need to sign in or sign up before continuing.×
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.
Just a suggestion on terminology here: 'The
depth()
method should return the maximum number of nodes one would need to visit to get from the current node to an empty node'The
depth
of a node in a tree is calculated from the root (depth 0) to where the node is. On the other hand,height
is calculated from the furthest leaf node (height 0) to the level at which the node is. While it's not exactly what is described by the problem, I feelheight
is more resemblant of what is being asked.I knew there must have been a better way than to copy and paste the code for each of the 9 digits... after looking at other people's solutions I see now this could have been executed much much much more elegantly, haha!
got it, thanks for the tips! still new at this, hah!
Same, I also did a chunky and ugly looking loop that checks against a list of month names haha... it looks like a disgrace next to this solution. But that's what's so cool about codewars! You're learning new practices all the time :)
Wow, thanks, that solved it for me -- I didn't even think about that :)
This comment is hidden because it contains spoiler information about the solution