Apple interview question

Matrix Shortest path