85: Max values of a binary tree

Given a binary tree, return maximum value on each level

 

Example 1

Input:        8        <--- level 0
             / \       
            2   3      <--- level 1
           /   / \ 
          4   5   10   <--- level 2

Output:  [8, 3, 10]

Example 2

Input:     2   
          / \  
         5   3 

Output: [2, 5]
Difficulty:Medium
Topic:Tree
Problem #:85