← All problemsSign in

341. Flatten Nested List Iterator

LeetCodeStackTreeDepth-First SearchDesignQueueIteratorOpen on judge ↗

You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it. Implement the NestedIterator class: - NestedIterator(List<NestedInteger> nestedList) Initializes the iterator with the nested list nestedList. - int next() Returns the next integer in the nested list. - boolean

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start