Design a nested-list iterator
Company: Adobe
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Technical Screen
Quick Answer: This question evaluates the ability to implement an efficient iterator over nested lists, testing skills in iterator state management, lazy traversal, explicit stack usage, and algorithmic complexity reasoning.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([1,[2,[3]],4],)
Expected Output: [1, 2, 3, 4]
Explanation: Nested integers.
Input: ([[],[1,[]],2],)
Expected Output: [1, 2]
Explanation: Empty nested lists.
Input: ([],)
Expected Output: []
Explanation: Empty input.
Hints
- Model object-style prompts as arrays or operation streams when needed.
- Handle empty and boundary cases before the main logic.