Design an Ordered Stream

Design a data structure OrderedStream that receives n unique pairs (id, value) where id is in [1, n].

The stream maintains a pointer ptr starting at 1. After inserting (id, value), if t...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: