[問題] LC 778. Swim in Rising Water已刪文
看板Prob_Solve (計算數學 Problem Solving)作者suhang (suhang)時間5年前 (2019/06/11 14:39)推噓0(0推 0噓 0→)留言0則, 0人參與討論串1/1
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解法一樣
只要隔壁滿足某些條件,就可以一直往隔壁走
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 73.189.14.17 (美國)
※ 文章網址: https://www.ptt.cc/bbs/Prob_Solve/M.1560235164.A.722.html
Prob_Solve 近期熱門文章
PTT數位生活區 即時熱門文章