Search
⌘K

Leetcode 1656. Design an Ordered Stream

Maintain an array-backed stream of n (id, value) pairs arriving out of order and, on each insert, return the largest contiguous chunk of values starting from the next expected id so that all returned chunks concatenate to the values sorted by id. Essentially: support inserts that may fill gaps and advance a pointer to emit consecutive stored values in increasing id order.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.