Find the Safest Path in a Grid
Measure each cell’s distance to the nearest thief with a multi-source BFS, then search for the path whose weakest cell is as safe as possible.
Measure each cell’s distance to the nearest thief with a multi-source BFS, then search for the path whose weakest cell is as safe as possible.