30:00
Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).
The number of nodes in the tree will be in the range [0,104][0, 10^4][0,104].
−231≤Node.val≤231−1-2^{31} \leq \text{Node.val} \leq 2^{31} - 1−231≤Node.val≤231−1
Run code to see results.
Start with level = [1]: row 0 holds only the root.
level
next
empty
result = []
Given a binary tree, return the largest value found on each row, from the top row down. An empty tree gives an empty list.