Solve a BFS coding problem.
Implement shortest_path(grid). The grid contains 0 for an open cell and 1 for an obstacle. Starting at the top-left cell, return the minimum number of cells in a four-directional path to the bottom-right cell, or -1 if no path exists.
Input is a non-empty rectangular list of lists. The start or destination may be blocked.
def shortest_path(grid):