Design a nested-list iterator
Company: Adobe
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Overview: 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.
Read the full Adobe Software Engineer interview experience this question came from
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.
Hints
- Model object-style prompts as arrays or operation streams when needed.
- Handle empty and boundary cases before the main logic.