DAYS
HOUR
MINS
SEC
Error
Given a binary tree, find the largest value in each level.
Example 1:
Input : 1 / \ 2 3 Output : 1 3 Explanation : There are two levels in the tree : 1. {1}, max = 1 2. {2, 3}, max = 3
Example 2:
Input : 4 / \ 9 2 / \ \ 3 5 7 Output : 4 9 7 Explanation : There are three levels in the tree: 1. {4}, max = 4 2. {9, 2}, max = 9 3. {3, 5, 7}, max=7
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes