Design a Lazy Union Iterator for Sorted Inputs

Quick Overview

Design a lazy iterator that merges two sorted integer streams while preserving duplicates and left-first ordering on ties. Ensure repeated availability checks do not consume output, keep buffering bounded, and generalize the contract to any number of sorted iterators.

Design a Lazy Union Iterator for Sorted Inputs

Company: MongoDB

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

Overview: Design a lazy iterator that merges two sorted integer streams while preserving duplicates and left-first ordering on ties. Ensure repeated availability checks do not consume output, keep buffering bounded, and generalize the contract to any number of sorted iterators.

MongoDB logo
MongoDB
Aug 26, 2026
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
11
0
Loading...