Convert BST to sorted doubly list
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Technical Screen
Quick Answer: This question evaluates understanding of binary search tree properties, in-order traversal, in-place pointer manipulation, and algorithmic complexity when converting tree nodes into a sorted doubly linked list.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([4,2,5,1,3],)
Expected Output: [1, 2, 3, 4, 5]
Explanation: In-order list.
Input: ([],)
Expected Output: []
Explanation: Empty tree.
Input: ([1],)
Expected Output: [1]
Explanation: Single node.
Hints
- Model object-style prompts as arrays or operation streams when needed.
- Handle empty and boundary cases before the main logic.