Posts tagged ‘math’

July 22, 2011

Interview Question: Cars on a Road

by Mikael

The question was posed roughly like this:

Suppose there is a very long road. Suppose there is a sequence of cars, C1, C2, C3, … that each move with its own constant speed that is such that C1 is slower than C2 which is slower than C3, and so on. The cars enter the road in the same sequence (C1 then C2 etc.) but at random locations. They are not allowed to overtake each other, so if a faster car catches up to a slower one, the faster must reduce speed and fall in behind.

After some time, how many groups of cars will there be on the road?

read more »