0% completed
Solution: Level Order Successor
Problem Statement
Given a root of the binary tree and an integer key, find the level order successor of the node containing the given key as a value in the tree.
The level order successor is the node that appears right after the given node in the level order traversal.
About the return value. Return the successor node itself, not its value. The test harness reads .val from whatever you return to print the result, so returning a plain number, or None, makes it fail with an attribute error. Every test on this question has a real successor.
.....
.....
.....
Spencer Lan
· a year ago
I'm getting this error even with correct solution, seems like the tree might not be built out correctly for the tests
grokking
· 2 years ago
Question says key is a node whereas in reality it is an int. Either pass in the node as stated in the problem description or change the wording to clarify that. Thank you.
Mikhail Putilov
· 4 years ago
elegant solution, 47
Reading Progress
0%