Back to problems

Shortest Path in a Grid with Obstacle Removal

Algorithm · Apple · Medium

Requirements Given a grid containing passable and blocked cells, determine the minimum number of moves from a starting cell to a destination cell. You may move only to neighboring cells. Movement is four-directional. k is the maximum number of blocked cells that may be opened, with each opened cell consuming one unit of that budget. Return the shortest distance when a route is available; otherwise, return -1. Notes Movement uses only the four cells directly above, below,…

Checking your access…