Skip to content

Commit

Permalink
Merge pull request youngyangyang04#1167 from IcePigZDB/zijiII
Browse files Browse the repository at this point in the history
子集II cpp 代码formate
  • Loading branch information
youngyangyang04 authored Apr 6, 2022
2 parents c4e11b2 + 9072045 commit e790032
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions problems/0090.子集II.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Solution {
private:
vector<vector<int>> result;
vector<int> path;
void backtracking(vector<int>& nums, int startIndex, vector<bool>& used) {
void backtracking(vector<int>& nums, int startIndex) {
result.push_back(path);
unordered_set<int> uset;
for (int i = startIndex; i < nums.size(); i++) {
Expand All @@ -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();
}
}
Expand All @@ -105,9 +105,8 @@ public:
vector<vector<int>> subsetsWithDup(vector<int>& nums) {
result.clear();
path.clear();
vector<bool> used(nums.size(), false);
sort(nums.begin(), nums.end()); // 去重需要排序
backtracking(nums, 0, used);
backtracking(nums, 0);
return result;
}
};
Expand Down

0 comments on commit e790032

Please sign in to comment.