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!
You're welcome.
Also since this isn't an issue with the kata, you should mark it as resolved.
You can do that using the checkbox when making a reply to your comment.
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 :)
Maybe you should also console.log the enteredCode and correctCode?
This comment is hidden because it contains spoiler information about the solution