๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm ๐Ÿง‘๐Ÿป‍๐Ÿ’ป/Leetcode

[Leetcode,c++] Permutations II

by dkswnkk 2021. 11. 15.

๋ฌธ์ œ

 

Permutations II - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

์ฝ”๋“œ

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

๋Œ“๊ธ€