class Solution {
//DFS
public:
vector
// Start typing your C/C++ solution below
// DO NOT write int main() function
int n = num.size();
if(0 == n) return vector
sort(num.begin(), num.end());
vector
vector
vector
permute_aux(n, used, path, ans, num);
return ans;
}
void permute_aux( int n, vector
{
if(0 == n)
{
ans.push_back(path);
return;
}
for (int i = 0; i < used.size(); ++i)
{
if(false == used[i])
{
used[i] = true;
path.push_back(num[i]);
permute_aux(n-1, used, path, ans, num);
used[i] = false;
path.pop_back();
}
}
}
};