Pattern · Iterator

Iterator interview questions

5 iterator problems tagged across recent interview reports. Drilled most heavily by airbnb, linkedin, and coinbase.

Founder's read

Iterator problems ask you to build stateful objects that traverse data structures one element at a time, often lazily. With 5 total problems tagged here and heavy drilling at Airbnb and LinkedIn, this pattern shows up when interviewers want to see if you understand encapsulation, state management, and memory efficiency. The trick isn't the traversal itself, it's implementing next() and hasNext() correctly without loading the entire structure upfront. If you hit a Binary Search Tree Iterator or Flatten Nested List Iterator variant in your live OA and blank, StealthCoder solves it invisibly in seconds.

Most-asked iterator problems

#ProblemDiff# Companies
01Flatten Nested List IteratorMEDIUM12
02Flatten 2D VectorMEDIUM4
03Binary Search Tree IteratorMEDIUM3
04Zigzag IteratorMEDIUM2
05Peeking IteratorMEDIUM1
The hedge for the live OA

You can't drill every iterator variant before the assessment. StealthCoder runs invisibly during screen share and solves whichever variant they throw at you. No browser extension. No detection signature. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

Iterator problems disguise themselves as 'design' questions but are really about lazy evaluation and tracking position. You'll recognize them by the requirement to implement next() and hasNext() methods, or by needing to flatten a complex structure on-the-fly. Common subtypes: tree traversal iterators (in-order, level-order), flattening nested containers (2D vectors, nested lists), and peeking iterators that let you inspect the next value without consuming it. Drill in this order: start with Binary Search Tree Iterator to nail the state-tracking pattern, move to Flatten 2D Vector for indexing tricks, then tackle Flatten Nested List Iterator and Peeking Iterator for higher complexity. Zigzag Iterator rounds out the set with alternation logic. This pattern is the hedge for the live OA, it's where candidates freeze because they're building the wrong mental model. StealthCoder reads the problem, sees the structure, and delivers working code before the clock ticks.

Companies that hire most on iterator

The honest play

5 iterator problems. You won't drill them all. Pass anyway.

Iterator is one of the patterns interviews actually filter on. Memorizing every variant in a week is a fantasy. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds, no matter which iterator flavor lands in your live OA. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Iterator interview FAQ

How many iterator problems should I drill before an interview?+

All 5 if you can. The full set, from tree iterators to nested flattening to peeking, covers the range you'll face. Airbnb and LinkedIn each have 5 problems tagged here, so if you're interviewing there, treat this as essential. Even 2-3 reps per problem builds the state-management muscle memory.

How do I recognize an iterator problem in the wild?+

Three signals: you're asked to implement next() and hasNext(), the data structure is nested or ordered and needs traversal, or memory efficiency is a hidden requirement (don't load everything upfront). Peeking is a bonus signal. If the problem says 'design an iterator,' you're in the pattern.

Which iterator problems are the hardest?+

Flatten Nested List Iterator and Peeking Iterator push you hardest. They require recursion or defensive peeking logic and careful state handling. Start with Binary Search Tree Iterator and Flatten 2D Vector to build confidence, then level up.

Do I need to know recursive iterators vs. iterative?+

Yes. Iterative is faster and cleaner for trees; recursive is often cleaner for nested structures. Both show up. Practice both approaches so you can pivot if one gets messy. The flattening problems especially benefit from seeing both.

Which company drills iterator patterns the hardest?+

Airbnb and LinkedIn tie at 5 problems each. Coinbase, OpenAI, and X each have 4. If you're in a loop with any of those, iterator is non-negotiable. Google, Meta, and Apple also tag it, so it's table stakes across tier-1.

Problem and frequency data sourced from public community-maintained interview-report repos. Problems and trademarks © LeetCode.