Breadth-First Search (BFS) to find the leftmost value in the last row
Initialize a queue and enqueue the root node along with its level (starting from 0).
While the queue is not empty, perform the following steps:
a. Dequeue a node from the queue and record its level.
b. If the current level is greater than the previously recorded level, update the answer with the current node's value as it is the first node of the new level.
c. Enqueue the left child of the current node if it exists, along with the next level number.
d. Enqueue the right child of the current node if it exists, along with the next level number.
Continue the process until the queue is empty. The answer recorded will be the leftmost value in the last row of the tree.
Depth-First Search (DFS) to find the leftmost value in the last row