class Solution { public: vector<vector<int>> res; void fun(vector<int> &num,vector<int> list){ if(list.size() == num.size()){ res.push_back(list); return ; } for(int i = 0; i < num.size(); i++){ if(count(list.begin(),list.end(),num[i])){ continue; } list.push_back(num[i]); fun(num,list); list.pop_back(); } } vector<vector<int>> permute(vector<int> &num) { vector<int> list; fun(num,list); return res; } };