Compute binary tree left-side view
Company: Meta
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: This question evaluates understanding of binary tree traversal and level-order reasoning, including distinctions between recursive and iterative approaches and handling of edge cases such as skewed or missing children.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([1,2,3,None,5,None,4],)
Expected Output: [1, 2, 5]
Explanation: Left view through sparse tree.
Input: ([],)
Expected Output: []
Explanation: Empty tree.
Hints
- Choose a representation that makes the requested operation direct.
- Handle empty inputs and boundary cases first.