grid[r][c] is the height of a platform. At time t the water level is t, and you can swim from a cell to a neighbour (up, down, left, right) if both have height at most t. You start at the top-left at time 0. Return the least time at which you can reach the bottom-right cell.
For [[0, 2], [1, 3]] the answer is 3.
Example 1
Input:
swim_in_water([[0, 2], [1, 3]])
Output:
3
Example 2
Input:
swim_in_water([[0, 1, 2, 3, 4], [24, 23, 22, 21, 5], [12, 13, 14, 15, 16], [11, 17, 18, 19, 20], [10, 9, 8, 7, 6]])
Output:
16
1 <= rows, cols <= 1000 to rows * cols - 1.No results yet
Run your code to check it against the examples, or submit to run every test.