BNSF Railway interview question

Solve a coding challenge that required both algorithmic thinking and efficient Python implementation under a strict time limit.