討論串[閒聊] 每日leetcode
共 1548 篇文章

推噓1(1推 0噓 1→)留言2則,0人參與, 1年前最新作者sustainer123 (caster )時間1年前 (2024/04/21 14:22), 編輯資訊
0
0
1
內容預覽:
思路:. 建圖 然後dfs. class Solution:. def validPath(self, n: int, edges: List[List[int]], source: int,. destination: int) -> bool:. dic = {}. visited = set(
(還有414個字)

推噓2(2推 0噓 1→)留言3則,0人參與, 1年前最新作者oinishere (是oin捏)時間1年前 (2024/04/21 13:08), 編輯資訊
0
0
1
內容預覽:
思路解法:. 用dp+bfs. 我記得這樣好像算是dijk甚麼東西的. 反正就是要一直看走過的地方能到哪裡. 然後我runtime 超久 靠北. 我要去看優化了. ```cpp. class Solution {. public:. bool validPath(int n, vector<vect
(還有980個字)

推噓2(2推 0噓 0→)留言2則,0人參與, 1年前最新作者Rushia (早瀬ユウカの体操服 )時間1年前 (2024/04/21 12:44), 1年前編輯資訊
0
0
1
內容預覽:
https://leetcode.com/problems/find-if-path-exists-in-graph/description. 1971. Find if Path Exists in Graph. 給你一個陣列表示的圖,判斷 source 和 destination 是否連通。.
(還有580個字)

推噓1(1推 0噓 2→)留言3則,0人參與, 1年前最新作者DJYOSHITAKA (franchouchouISBEST)時間1年前 (2024/04/20 21:24), 編輯資訊
0
0
0
內容預覽:
1992. Find All Groups of Farmland. 你板帥潮都DFS. 我獨自forloop. vector<vector<int>> findFarmland(vector<vector<int>>& land) {. vector<vector<int>> ans;. for(
(還有596個字)

推噓3(3推 0噓 1→)留言4則,0人參與, 1年前最新作者sustainer123 (caster )時間1年前 (2024/04/20 19:58), 編輯資訊
0
0
0
內容預覽:
思路:. 遍歷整個list 遇到1就dfs 因為右下角必然是整個矩形的最大值. 用max()找到最大值就可以得到答案. Python Code:. class Solution:. def findFarmland(self, land: List[List[int]]) -> List[List[
(還有640個字)