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; } };