This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingReturn the nodes visible when the binary tree is viewed from the left.
What this asks
Return the nodes visible when the tree is viewed from the left.
Visit left children before right ones and keep the first node met at a depth the view has not filled yet: that is the leftmost node at its depth. The level-order sibling builds the same answer with a queue.
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing