Google interview question

Car race problem. Very complex..