Back to problems

Out-of-Order Package Receiver

Algorithm · Amazon · Medium

Package Arrival Monitor Easy · Topics: Design, Hash Table, Prefix · Company Tags · Hints Implement a package tracking system. Packages are numbered with integer IDs starting from 0. They can arrive in any order. You must provide two operations: receive(int id) – records that the package with this id has been received. The same id may be recorded multiple times; duplicate arrivals should be ignored. query() – returns a list containing exactly two items: An integer k: the…

Checking your access…