๋ฌธ์
์ฝ๋
class Solution {
public:
vector<vector<int>> permuteUnique(vector<int>& nums) {
vector<vector<int>>ans;
sort(nums.begin(),nums.end());
do{
ans.push_back(nums);
}while(next_permutation(nums.begin(),nums.end()));
return ans;
}
};
'Algorithm ๐ง๐ปโ๐ป > Leetcode' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Leetcode,c++] Combination Sum II (0) | 2021.11.16 |
---|---|
[Leetcode,c++] Subsets II (0) | 2021.11.15 |
[Leetcode,c++] Rotate Image (0) | 2021.11.15 |
[Leetcode,c++] Roman to Integer (0) | 2021.11.15 |
[Leetcode,c++] Find First and Last Position of Element in Sorted Array (0) | 2021.11.14 |
[Leetcode,c++] Group Anagrams (0) | 2021.11.14 |
๋๊ธ