From 907204559fb56504a0035d70cbe478996152e8d3 Mon Sep 17 00:00:00 2001 From: IcePigZDB Date: Sat, 19 Mar 2022 20:15:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=90=E9=9B=86II=20cpp=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?formate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: IcePigZDB --- "problems/0090.\345\255\220\351\233\206II.md" | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git "a/problems/0090.\345\255\220\351\233\206II.md" "b/problems/0090.\345\255\220\351\233\206II.md" index 16bd1f2c19..d08707b4f6 100644 --- "a/problems/0090.\345\255\220\351\233\206II.md" +++ "b/problems/0090.\345\255\220\351\233\206II.md" @@ -87,7 +87,7 @@ class Solution { private: vector> result; vector path; - void backtracking(vector& nums, int startIndex, vector& used) { + void backtracking(vector& nums, int startIndex) { result.push_back(path); unordered_set uset; for (int i = startIndex; i < nums.size(); i++) { @@ -96,7 +96,7 @@ private: } uset.insert(nums[i]); path.push_back(nums[i]); - backtracking(nums, i + 1, used); + backtracking(nums, i + 1); path.pop_back(); } } @@ -105,9 +105,8 @@ public: vector> subsetsWithDup(vector& nums) { result.clear(); path.clear(); - vector used(nums.size(), false); sort(nums.begin(), nums.end()); // 去重需要排序 - backtracking(nums, 0, used); + backtracking(nums, 0); return result; } };