6 kyu
The Strongest Tree in the Forest
90Abbabon
Description:
You have a class called Node, representing a node in a binary tree (https://en.wikipedia.org/wiki/Binary_tree).
Each node has 2 children - the right child and the left child. These children can of course be null.
You job is to add an instance method, height, which returns the longest branch steming from the tree (starting from this node). For example, this tree would result in 3:
(Node)
/ \
(Node) (Node)
/ \
(Node) (Node)
\
(Node)
Recursion is not necessary, but highly recommended.
Fundamentals
Algorithms
Recursion
Similar Kata:
Stats:
Created | Dec 27, 2017 |
Published | Dec 27, 2017 |
Warriors Trained | 207 |
Total Skips | 25 |
Total Code Submissions | 268 |
Total Times Completed | 90 |
Ruby Completions | 90 |
Total Stars | 4 |
% of votes with a positive feedback rating | 85% of 27 |
Total "Very Satisfied" Votes | 19 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 7 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |