Watch 10 video solutions for Find Largest Value in Each Tree Row, a medium level problem involving Tree, Depth-First Search, Breadth-First Search. This walkthrough by Nick White has 17,048 views views. Want to try solving it yourself? Practice on FleetCode or read the detailed text solution.
Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).
Example 1:
Input: root = [1,3,2,5,3,null,9] Output: [1,3,9]
Example 2:
Input: root = [1,2,3] Output: [1,3]
Constraints:
[0, 104].-231 <= Node.val <= 231 - 1