Your question is Find Shortest Path in a Grid Using BFS. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a 2D grid represented as a list of lists, where 0 represents an open cell and 1 represents a wall, implement a BFS algorithm to find the shortest path from the top-left corner (0, 0) to the bottom-right corner (n-1, m-1). If no path exists, return -1.
def shortest_path_bfs(grid):