LeetCode 47

class Solution {
public:
vector<vector<int>> permuteUnique(vector<int>& nums) {
set<vector<int>> res;
vector<int> add;
vector<int> vis(nums.size(),);
BFS(nums,res,add,vis,);
return vector<vector<int>>(res.begin(),res.end()); } void BFS(vector<int>& nums,set<vector<int>>& res,vector<int>& add,vector<int>& vis,int level){
if(level == nums.size()){res.insert(add);return;}
else{
for(int i=;i < nums.size();i++){
if(vis[i] == ){
vis[i] = ;
add.push_back(nums[i]);
BFS(nums,res,add,vis,level+);
add.pop_back();
vis[i] = ;
}
}
}
}
};
上一篇:Linux 下获取LAN中指定IP的网卡的MAC(物理地址)


下一篇:关于IOC和DI的理解