6 kyu
Sum The Tree
2,257 of 4,921jz9000
Description:
Given a node object representing a binary tree:
Node:
value: <int>,
left: <Node> or null,
right: <Node> or null
write a function that returns the sum of all values, including the root. Absence of a node will be indicated with a null
value.
Examples:
10
| \
1 2
=> 13
1
| \
0 0
\
2
=> 3
Trees
Recursion
Binary Trees
Binary Search Trees
Data Structures
Fundamentals
Similar Kata:
Stats:
Created | Oct 14, 2016 |
Published | Oct 14, 2016 |
Warriors Trained | 9717 |
Total Skips | 2100 |
Total Code Submissions | 15516 |
Total Times Completed | 4921 |
JavaScript Completions | 2257 |
C++ Completions | 1448 |
C Completions | 933 |
C# Completions | 438 |
Total Stars | 186 |
% of votes with a positive feedback rating | 90% of 781 |
Total "Very Satisfied" Votes | 646 |
Total "Somewhat Satisfied" Votes | 119 |
Total "Not Satisfied" Votes | 16 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |