52: Binary tree right side view

Дано бинарное дерево, найдите вид справа

 

Пример 1

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

Output: [8, 3, 1, 2]

Пример 2

Input:     2   
          / \  
         5   3 

Output: [2, 3]
Difficulty:Medium
Topic:Tree
Problem #:52