diff --git a/problems/0417.太平洋大西洋水流问题.md b/problems/0417.太平洋大西洋水流问题.md index 35f3b4d6..6777e2d9 100644 --- a/problems/0417.太平洋大西洋水流问题.md +++ b/problems/0417.太平洋大西洋水流问题.md @@ -180,14 +180,14 @@ public: // 从最上最下行的节点出发,向高处遍历 for (int i = 0; i < n; i++) { - dfs (heights, pacific, i, 0); // 遍历最上行,接触太平洋 - dfs (heights, atlantic, i, m - 1); // 遍历最下行,接触大西洋 + dfs (heights, pacific, i, 0); // 遍历最左列,接触太平洋 + dfs (heights, atlantic, i, m - 1); // 遍历最右列,接触大西 } // 从最左最右列的节点出发,向高处遍历 for (int j = 0; j < m; j++) { - dfs (heights, pacific, 0, j); // 遍历最左列,接触太平洋 - dfs (heights, atlantic, n - 1, j); // 遍历最右列,接触大西洋 + dfs (heights, pacific, 0, j); // 遍历最上行,接触太平洋 + dfs (heights, atlantic, n - 1, j); // 遍历最下行,接触大西洋 } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { diff --git a/problems/图论深搜理论基础.md b/problems/图论深搜理论基础.md index af4073f0..7f847f8f 100644 --- a/problems/图论深搜理论基础.md +++ b/problems/图论深搜理论基础.md @@ -142,7 +142,7 @@ void dfs(参数) 通常我们递归的时候,我们递归搜索需要了解哪些参数,其实也可以在写递归函数的时候,发现需要什么参数,再去补充就可以。 -一般情况,深搜需要 二维数组数组结构保存所有路径,需要一维数组保存单一路径,这种保存结果的数组,我们可以定义一个全局遍历,避免让我们的函数参数过多。 +一般情况,深搜需要 二维数组数组结构保存所有路径,需要一维数组保存单一路径,这种保存结果的数组,我们可以定义一个全局变量,避免让我们的函数参数过多。 例如这样: