Subway interview question

How to solve the problem.