Amazon interview question

Matrix Breadth First Search - LC Med