Given a
mxngrid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note: You can only move either down or right at any point in time.
給一個
mxn且用非負數填滿的網格,找到一條路徑從最左上到最右下且經過的數字總和最小。
提示:在任ㄏㄏㄏ你每次只能往下或往右移動
dp[i][j]紀錄到點grid[i][j]需要的最短步數。i, j) = (0, 0),dp[i][j] = grid[i][j]j = 0,dp[i][j] = dp[i - 1][j]i = 0,dp[i][j] = dp[i][j - 1]dp[i][j] = min(dp[i - 1][j], dp[i][j - 1])LeetCode C++