Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Top View of a Binary Tree

Medium Binary Trees

Print the nodes visible when the tree is seen from above, from the leftmost to the rightmost column. If several nodes share a column, the one closest to the root is visible.

Constraints

1 <= number of nodes <= 10^5

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.