513 Find Bottom Left Tree Value
Given a binary tree, find the leftmost value in the last row of the tree.
Example 1:
Example 2:
Note:You may assume the tree (i.e., the given root node) is not NULL.
Complexity: O(n) time, O(logn) space
The Idea: Run a level order traversal with a small twist: check for instances when the next level arises (left to right top to bottom), and collect the first left instance.
Last updated