From 814ea3ec47208c7cfcf208b288fc8e6a5822782f Mon Sep 17 00:00:00 2001 From: zhicheng lee <904688436@qq.com> Date: Wed, 31 Aug 2022 09:52:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=200078.=E5=AD=90=E9=9B=86.md?= =?UTF-8?q?=20=E5=8E=BB=E9=99=A4Java=E4=BB=A3=E7=A0=81=E4=B8=AD=E5=86=97?= =?UTF-8?q?=E4=BD=99=E7=9A=84=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit subsetsHelper(int[] nums, int startIndex)函数的第一行包含了被去除代码的功能,因此去掉主函数中冗余的代码 --- problems/0078.子集.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/problems/0078.子集.md b/problems/0078.子集.md index 3e98311e..a9ffd696 100644 --- a/problems/0078.子集.md +++ b/problems/0078.子集.md @@ -180,10 +180,6 @@ class Solution { List> result = new ArrayList<>();// 存放符合条件结果的集合 LinkedList path = new LinkedList<>();// 用来存放符合条件结果 public List> subsets(int[] nums) { - if (nums.length == 0){ - result.add(new ArrayList<>()); - return result; - } subsetsHelper(nums, 0); return result; }