7 of 9
Write a function has_path(maze, row, col, visited) that:
True if there is a path from (row, col) to the bottom-right cornerFalse otherwise0 = wall, 1 = open pathStart by calling has_path(maze, 0, 0, set()).
maze1 = [ [1, 0, 1], [1, 1, 1], [0, 0, 1] ] print(has_path(maze1, 0, 0, set())) # True # Path: (0,0) → (1,0) → (1,1) → (1,2) → (2,2) maze2 = [ [1, 0, 1], [0, 0, 1], [0, 0, 1] ] print(has_path(maze2, 0, 0, set())) # False # (0,0) is surrounded — no way through