Skip to content

Commit

Permalink
子集II cpp 代码formate
Browse files Browse the repository at this point in the history
Signed-off-by: IcePigZDB <[email protected]>
  • Loading branch information
IcePigZDB committed Mar 19, 2022
1 parent 5023c9d commit 9072045
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 9072045

Please sign in to comment.