Given an n × n grid where grid[i][j] represents elevation, find the minimum time to swim from top-left to bottom-right.
At time t, you can swim through any cell with elevation . You start at time t = grid[0][0] (must wait until water rises to your starting elevation).
With grid = [[0,2],[1,3]]:
- At t=0: Can only be at (0,0).
- At t=1: Can reach (1,0).
- At t=2: Can reach (0,1).
- At t=3: Can reach (1,1).
- Answer: 3.
Return the minimum time to reach (n-1, n-1).
Constraints: . Each cell value is unique and in .