Minimize the Steepest Step on a Grid Route. Travel from the top-left to the bottom-right cell of heights, moving only between side-adjacent cells. The effort of a route is the largest absolute height change on any step.
### Problem
Travel from the top-left to the bottom-right cell of `heights`, moving only between side-adjacent cells. The effort of a route is the largest absolute height change on any step. Return the smallest achievable effort.
```cpp
class Solution {
public:
int minimumEffortPath(vector<vector<int>>& heights);
};
```
### Examples
**Example 1:**
```text
heights = [[2,6],[3,4]]
Output: 1
Explanation: Follow heights 2 -> 3 -> 4, with step differences 1 and 1.
```
**Example 2:**
```text
heights = [[9,1,8]]
Output: 8
Explanation: The only route has step differences 8 and 7.
```
### Constraints
- `rows == heights.length`, `columns == heights[i].length`.
- `1 <= rows,columns <= 100`.
- Heights are integers in `[1,10^6]`.
### Clarifying Questions
Minimize the maximum edge difference, not the sum of differences. A route consisting of a single cell has effort zero.
```hint Inspect the structure
How do you compare two route efforts when several small steps compete with one large step?
```
### Reasoning checkpoints
- Compare route effort using its largest step change rather than a sum.
- Prove that no alternative route has a smaller effort, including equal-height and one-cell cases.
### Optional extensions
How would a threshold reachability check support binary search for the same answer?
Overview: Minimize the Steepest Step on a Grid Route. Travel from the top-left to the bottom-right cell of heights, moving only between side-adjacent cells. The effort of a route is the largest absolute height change on any step.
Travel from the top-left to the bottom-right cell of heights, moving only between side-adjacent cells. The effort of a route is the largest absolute height change on any step. Return the smallest achievable effort.
class Solution {
public:
int minimumEffortPath(vector<vector<int>>& heights);
};
Examples
Example 1:
heights = [[2,6],[3,4]]
Output: 1
Explanation: Follow heights 2 -> 3 -> 4, with step differences 1 and 1.
Example 2:
heights = [[9,1,8]]
Output: 8
Explanation: The only route has step differences 8 and 7.