Google Interview Question

Car race problem. Very complex..