Create Tree Top View
- Lingua principale
- C++
- Stelle
- 504
- Fork
- 436
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Given a binary tree , print the nodes in left to right manner as visible from above the tree
Input Format
Level order input for the binary tree will be given.
Constraints
No of nodes in the tree can be less than or equal to 10^7
Output Format
A single line containing space separated integers representing the top view of the tree
Sample Input
1 2 3 4 5 6 -1 -1 -1 -1 -1 -1 -1
Sample Output
4 2 1 3
Explanation
The tree looks like
1
/ \
2 3
/ \ /
4 5 6
When viewed from the top , we would see the nodes 4, 2, 1 and 3.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.