[LeetCode](week4) 778. Swim in Rising Water - 简书
778. Swim in Rising Water
题目
On an N x N grid
, each square grid[i][j]
represents the elevation at that point (i,j)
.
Now rain starts to fall. At time t
, the depth of the water everywhere is t
. You can swim from a square to another 4-directionally adjacent square if and only if the elevation of both squares individually are at most t
. You can swim infinite distance in zero time. Of course, you must stay within the boundaries of the grid during your swim.
You start at the top left square (0, 0)
. What is the least time until you can reach the bottom right square (N-1, N-1)
?
Read full article from [LeetCode](week4) 778. Swim in Rising Water - 简书
No comments:
Post a Comment