Algorithm · Amazon · Hard
A parking-lot sensor emits records of the form [carId, time, eventType], where carId identifies a vehicle, time is an integer timestamp counted in hours, and eventType is either 'entry' or 'exit'. The records are not guaranteed to arrive in chronological order. Every arrival is paired with a departure belonging to the same carId; the paired departure timestamp is strictly larger than the arrival timestamp, and no vehicle ever has two stays open at once. A stay occupies the…
Checking your access…