Given an n x n grid where grid[i][j] is the elevation, water level rises over time. At time t you can swim between adjacent cells if both have elevation <= t. Return the least time to reach (n-1,n-1) from (0,0). Input: JSON 2D grid.
Input: A JSON n x n integer grid.
Output: Integer — minimum time.
Input: [[0,2],[1,3]]
Output: 3
Explanation: Must wait until time 3 to reach bottom-right.Input: [[0]]
Output: 0
Explanation: Already at destination.1<=n<=500<=grid[i][j]<n^2all values distinct