(node, graph, visited)
| 33 | }; |
| 34 | |
| 35 | const dfs = (node, graph, visited) => { |
| 36 | if (visited.has(node)) return; |
| 37 | visited.add(node); |
| 38 | |
| 39 | for (const neighbor of graph[node]) { |
| 40 | dfs(neighbor, graph, visited); |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | /** |
| 45 | * https://leetcode.com/problems/graph-valid-tree/ |