(LeetCode)515.Find Largest Value in Each Tree Row

1.Description(Medium)

You need to find the largest value in each row of a binary tree.

Example:

Input:


          1
         / \
        3   2
       / \   \  
      5   3   9 


Output:
 [1, 3, 9]

2.Code

维护一个变量去找到每次的最大值

Last updated

Was this helpful?