Route with the smallest worst step
A hiker crosses a height map heights (a grid of integers) from the top-left cell to the bottom-right cell, moving one cell up, down, left or right at a time. The size of a step is the absolute difference between the two heights, and a route is only as hard as its worst (biggest) step. Return the smallest possible worst step over all routes.
The grid has 1 to 20 rows and columns, and heights may be negative. A single cell needs no steps: return 0.
Besides the tests, one large input (a 5×6 grid) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
smallest_worst_step([[1,3,5],[2,8,4],[3,4,5]])→1smallest_worst_step([[0,0,0],[2,100,0],[1,3,5]])→2smallest_worst_step([[1,1,1],[9,9,1],[1,1,1],[1,9,9],[1,1,1]])→0