計算數學 Problem Solving- LC 778. Swim in Rising Water

匿 匿名 670 次瀏覽 0 個回答

https://leetcode.com/problems/swim-in-rising-water/

my thought and code
https://paste.ubuntu.com/p/gfpyZWFbxD/

input grid = [[3,2],[0,1]]
expected 3
為什麼呢?
出發位置在 (0,0), 高度為3, 比右邊和下面兩格都要高,不能一口氣直接游過去嗎?

Now rain starts to fall.
At time t, the depth of the water everywhere is t
t時刻,每個格子的水量都是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
這兩句關鍵的敘述看不太懂


~~
之前做過the maze ii (題目付費會員才能看)
https://leetcode.com/problems/the-maze-ii/
題目可以看這篇blog
https://www.cnblogs.com/grandyang/p/6725380.html
我本以為 778這題和the maze ii BFS解法一樣
只要隔壁滿足某些條件,就可以一直往隔壁走




--

我要回答

0 個回答

還沒有人回答,你知道答案嗎?

我要回答

登入會員後即可回答問題。

免費註冊