root of a non-empty binary tree. Find the lowest level of the tree (the one farthest from the root) and return the value of the leftmost node on it.
Note that this node does not have to be a left child: you need the leftmost node of the last level, whatever its parent.root=tree_node([10, 4, 7, None, 2, 9, 1]) → 2
The lowest level is 2, 9, 1. The leftmost of them is 2, even though it is the right child of 4.
root=tree_node([5, 3, 8, None, None, 6, None, -4]) → -4
The deepest level holds a single node, -4 (5 → 8 → 6 → -4), so that is the answer.
root=tree_node([42]) → 42
Node.val ≤ 2³¹ - 1root=tree_node([10, 4, 7, None, 2, 9, 1])
2
Run checks the first 3 tests in your browser. Submit checks all 87 tests on the server, hidden ones included.