1000 {
1001 auto ans = vector<vector<int>>();
1002 if(nums.size() == 1) {
1003 auto next_ans = vector<int>();
1004 next_ans.push_back(nums[0]);
1005 ans.push_back(next_ans);
1007 }
1008 for(auto num: nums) {
1009 auto next = vector(nums);
1010 next.erase(
find(next.begin(), next.end(), num));
1011 auto next_permutations =
permute(next);
1012 auto new_ans = vector<int>();
1013 new_ans.push_back(num);
1014 for(auto next_permutation: next_permutations) {
1015 auto next_ans = vector(new_ans);
1016 next_ans.insert(next_ans.end(), next_permutation.begin(), next_permutation.end());
1017 ans.push_back(next_ans);
1018 }
1019 }
1021 }
bool find(vector< unordered_set< int > > &g, int x, vector< bool > &st, vector< int > &match)
vector< vector< int > > ans
static vector< vector< int > > permute(vector< int > &nums)