Pregunta de entrevista de Google

Car race problem. Very complex..