Find the deepest level of the binary tree and return the value of the leftmost node on that level. A node's depth is the number of edges from the root, so the root has depth 0. The answer depends on position, not on which value is numerically smallest.
Examples use level-order arrays. After the root, each present node contributes left and right child entries in queue order. null marks a missing child, and trailing missing entries may be omitted.
Example 1:
Input: root = [8,6,2,9,null,1,0]
Output: 9Explanation: The deepest row contains [9,1,0]. Its leftmost value is 9, even though the other values are smaller.
Example 2:
Input: root = [4,null,7,3,5]
Output: 3Explanation: The deepest row contains [3,5], both in the root's right subtree. The leftmost node on that row has value 3.
Example 3:
Input: root = [-2]
Output: -2Explanation: The root is the only node, so it is also the leftmost node on the deepest level.
Constraints:
- The tree contains between 1 and 10000 nodes.
-2147483648 <= Node.val <= 2147483647