You are given an m $ imes$ n integer matrix points with indices starting at
To accumulate score, you must choose exactly one cell from each row. Choosing the cell at coordinate (r, c) adds points[r][c] to your score.
However, your score decreases if you choose a cell that is far from the cell chosen in the previous row. For every two adjacent rows r and r r r, c1) and (r c2) subtracts c1 c2
Return the maximum score you can achieve.
Constraints:
m points.length
n points[r].length
m, n
m $ imes$ n
points[r][c]
You are given an m $ imes$ n integer matrix points with indices starting at
To accumulate score, you must choose exactly one cell from each row. Choosing the cell at coordinate (r, c) adds points[r][c] to your score.
However, your score decreases if you choose a cell that is far from the cell chosen in the previous row. For every two adjacent rows r and r r r, c1) and (r c2) subtracts c1 c2
Return the maximum score you can achieve.
Constraints:
m points.length
n points[r].length
m, n
m $ imes$ n
points[r][c]