Two Sigma interview question

Simple BFS problem, data