Release Values in Id Order

Asked at Bloomberg · Coding Questions · Difficulty: Easy

Design a class that receives `n` values, each tagged with a unique integer id from `1` to `n`, in any order. The class must hand the values back in increasing id order: a value is released only once every smaller id has already been inserted and released.

Loading the problem…