Left View

0

0 votes
Easy
Problem

A tree is constructed in the same fashion as in question 3. Find out the left view of the tree. Left view of a level is the leftmost node at that level.

Input format and constraints are similar to the question 3.

Output format:

In a single line print the left view of the tree from level one to last.

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

Constructed Tree:

                      1
                        \
                        4
                       /  \
                      4    5
                            \ 
                             6

Left View:

1 4 4 6

Editor Image

?