6 kyu
Binary Tree Compare
902 of 1,929bovard
Description:
Given the node object:
Node:
val: <int>,
left: <Node> or null,
right: <Node> or null
write a function compare(a, b)
which compares the two trees defined by Nodes a and b and returns true
if they are equal in structure and in value and false
otherwise.
Examples:
1 1
| \ | \
2 3 2 3
=> true
1 1
| \ | \
3 3 2 3
=> false (values not the same 2 != 3)
1 1
| \ |
2 3 2
|
3
=> false (structure not the same)
Binary Trees
Algorithms
Similar Kata:
Stats:
Created | Jun 19, 2015 |
Published | Jun 19, 2015 |
Warriors Trained | 3750 |
Total Skips | 237 |
Total Code Submissions | 14909 |
Total Times Completed | 1929 |
JavaScript Completions | 902 |
Python Completions | 903 |
C Completions | 125 |
Lua Completions | 26 |
COBOL Completions | 3 |
Haskell Completions | 49 |
Scala Completions | 6 |
Total Stars | 123 |
% of votes with a positive feedback rating | 94% of 311 |
Total "Very Satisfied" Votes | 281 |
Total "Somewhat Satisfied" Votes | 23 |
Total "Not Satisfied" Votes | 7 |