Algorithm · LinkedIn · Medium
You are given a chronological event log from a road system. Each record in logs is a pair (license_plate, event_type), where license_plate is a non-empty string and event_type is one of "ENTRY", "ROAD", or "EXIT". For a single vehicle, a trip is complete only when its records appear in the order ENTRY, then ROAD, then EXIT. Events for different vehicles may be interleaved, and the same vehicle may finish multiple trips. Implement get_trip(logs) and return the total number of…
Checking your access…