Back to problems

Merge Sorted Event Streams Through an Iterator

Algorithm · Amazon · Medium

Merge Event Streams Iterator Medium · Heap · Amazon · Only current heads are candidates; after popping, refill only that stream. Design an iterator that takes multiple event sequences, each pre‑sorted by timestamp, and merges them into a single chronological stream, processing events on the fly without preloading all data. You are given a list of streams streams and a list of operations operations. Every stream is an array of strings, each formatted as timestamp/payload,…

Checking your access…