First Unique Restaurant ID in an Order Stream

Implement a data structure for a stream of restaurant IDs. It must return the first restaurant ID that has appeared exactly once so far.

Implement class FirstUnique:

  • add(restaurant_id): append...

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: