From cb6f015186ae9d6af13cddf9b929f7bbdfe9bc29 Mon Sep 17 00:00:00 2001 From: cy948 <67412196+cy948@users.noreply.github.com> Date: Fri, 6 May 2022 14:43:58 +0800 Subject: [PATCH] =?UTF-8?q?Update=200112.=E8=B7=AF=E5=BE=84=E6=80=BB?= =?UTF-8?q?=E5=92=8C.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复了 0113.路径总和-ii 中Java递归解法中的类名大小写问题。 --- problems/0112.路径总和.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/problems/0112.路径总和.md b/problems/0112.路径总和.md index 41463ec1..2fdd7741 100644 --- a/problems/0112.路径总和.md +++ b/problems/0112.路径总和.md @@ -377,22 +377,22 @@ class solution { ```java class solution { - public list> pathsum(treenode root, int targetsum) { - list> res = new arraylist<>(); + public List> pathsum(TreeNode root, int targetsum) { + List> res = new ArrayList<>(); if (root == null) return res; // 非空判断 - - list path = new linkedlist<>(); + + List path = new LinkedList<>(); preorderdfs(root, targetsum, res, path); return res; } - public void preorderdfs(treenode root, int targetsum, list> res, list path) { + public void preorderdfs(TreeNode root, int targetsum, List> res, List path) { path.add(root.val); // 遇到了叶子节点 if (root.left == null && root.right == null) { // 找到了和为 targetsum 的路径 if (targetsum - root.val == 0) { - res.add(new arraylist<>(path)); + res.add(new ArrayList<>(path)); } return; // 如果和不为 targetsum,返回 }