Implement A* search with Manhattan distance to find the shortest path in a grid.
Constraints
Example
>>> grid = [ ... [0, 0, 1], ... [1, 0, 0], ... [0, 0, 0] ... ] >>> astar_path(grid, (0,0), (2,2)) 4 >>> astar_path(grid, (0,0), (0,2)) -1 >>> astar_path(grid, (0,0), (0,0)) 0
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints