Find the length of the shortest clear path in an n×n binary matrix using 8-directional moves.
Constraints
Example
>>> shortestPathBinaryMatrix([[0,1],[1,0]]) 2 >>> shortestPathBinaryMatrix([[0,0,0],[1,1,0],[1,1,0]]) 4 >>> shortestPathBinaryMatrix([[1,0],[0,0]]) -1
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints