MongoDB logo

MongoDB Interview Question Bank

MongoDB interviews favor practical, database-flavored coding over puzzle-style problems, and judge candidates on production-quality code rather than just a working answer. Concurrency is a recurring theme across coding, code-review and design rounds, and low-level teams probe operating-system and networking internals in depth.

Coding problems
9
Before you start
Showing 8 of 8
Coding
MediumFree preview

Union of Two Sorted Iterators

Implement a UnionIterator over two ascending-sorted iterators exposing hasNext()/next() (sometimes named getNext()). Output must be globally ascending, read lazily one element at a time, and in most versions de-duplicated across the two inputs. Follow-up: generalize to K sorted iterators without materializing the data (K-way merge with a heap).

SWE
iterator
merge
deduplication
heap
+1
4 related discussions

MongoDB Featured Guides