InterviewDB Experience

Car Passing: Count the Number of Times Cars Overtake Each Other on a One-Lane Road

Interview Experience

Problem N cars start at position 0 on a one-lane road and drive at constant speeds. A "passing event" occurs the instant a faster car catches a slower car ahead of it. Count the total number of passing events. Example: Follow-ups Is this equivalent to counting inversions? If so, can you solve it in O(n log n) using merge sort? What changes if the road has finite length and cars exit when they reach the end? How would you extend this to return the exact times each passing occurs? What if cars sta…

Full Details

🔒

Unlock all Waymo questions

Full insider details, leaked discussions, and candidate experiences.

or every company, $100/year →

About This Question

This is a candidate experience report from a waymo interview during the phone round.

It covers the following topics: Sorting, Coding, Phone .