1368. Minimum Cost to Make at Least One Valid Path in a Grid
LeetCodeArrayBreadth-First SearchGraph TheoryHeap (Priority Queue)MatrixShortest PathOpen on judge ↗
Given an m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of grid[i][j] can be: - 1 which means go to the cell to the right. (i.e go from grid[i][j] to grid[i][j + 1]) - 2 which means go to the cell to the left. (i.e go from grid[i][j] to grid[i][j - 1]) - 3 which means go to the lower cell. (i.e go from grid[i][
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start