class Solution {
public:
vector<vector<int>> permute(vector<int>& nums) {
vector<vector<int>>res;
sort(nums.begin(),nums.end());
res.push_back(nums);
while(next_permutation(nums.begin(),nums.end()))
{
res.push_back(nums);
}
return res;
}
};
LeetCode:046.全排列
最新推荐文章于 2021-08-12 19:25:51 发布