1959. Minimum Path Cost in a Hidden Grid

Medium
Array
Depth-First Search
Breadth-First Search
Graph
Heap (Priority Queue)
Matrix
Interactive
Shortest Path

Description

Hints

Hint 1
The grid is at a maximum 100 x 100, so it is clever to assume that the robot's initial cell is grid[101][101]
Hint 2
Run a DFS from the robot's position to make sure that you can reach the target, otherwise you should return -1.
Hint 3
Now that you are sure you can reach the target and that you know the grid, run Dijkstra to find the minimum cost.

Statistics

Acceptance
58.6%
Submissions
9,248
Accepted
5,418