You are given an m n integer matrix grid and an integer limit.
You need to select a subsequence of columns such that for every row i, the absolute difference between the elements in any two consecutive selected columns is at most limit.
Return the maximum number of columns that can be selected.
Constraints:
m grid.length
n grid[i].length
grid[i][j]
limit
You are given an m n integer matrix grid and an integer limit.
You need to select a subsequence of columns such that for every row i, the absolute difference between the elements in any two consecutive selected columns is at most limit.
Return the maximum number of columns that can be selected.
Constraints:
m grid.length
n grid[i].length
grid[i][j]
limit