Jane Street interview question

Bus problem