Minimum effort path
Your task
You are given an m x n grid of non-negative integer heights. Starting at (0,0) and ending at (m-1,n-1), moving 4-directionally, the 'effort' of a path is the maximum absolute height difference between any two consecutive cells on that path. Return the minimum possible effort over all paths. The grid has at least one cell.
Examples
min_effort_path(heights: list[list[int]]) -> intExample 1
Input
min_effort_path([[1, 2, 2], [3, 8, 2], [5, 3, 5]])Output
2