From 14d773ba19c0e0422d7c263af86652322ea16e8c Mon Sep 17 00:00:00 2001 From: youngyangyang04 <826123027@qq.com> Date: Sun, 15 Nov 2020 11:04:51 +0800 Subject: [PATCH] Update --- README.md | 1 + problems/0040.组合总和II.md | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 1530407d..8a530b8a 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ * [回溯算法:排列问题(二)](https://mp.weixin.qq.com/s/9L8h3WqRP_h8LLWNT34YlA) * [本周小结!(回溯算法系列三)](https://mp.weixin.qq.com/s/tLkt9PSo42X60w8i94ViiA) + (持续更新中....) # LeetCode 刷题攻略 diff --git a/problems/0040.组合总和II.md b/problems/0040.组合总和II.md index 6ff491df..7f07eef8 100644 --- a/problems/0040.组合总和II.md +++ b/problems/0040.组合总和II.md @@ -56,10 +56,13 @@ candidates 中的每个数字在每个组合中只能使用一次。 回看一下题目,元素在同一个组合内是可以重复的,怎么重复都没事,但两个组合不能相同。 + **所以我们要去重的是同一树层上的“使用过”,同一树枝上的都是一个组合里的元素,不用去重**。 为了理解去重我们来举一个例子,candidates = [1, 1, 2], target = 3,(方便起见candidates已经排序了) +**强调一下,树层去重的话,需要对数组排序!** + 选择过程树形结构如图所示: