class Solution {
public:
vector<string> Permutation(string str) {
vector<string> arr;
if(str.empty()){
return arr;//判空操作
}
int length=str.size();
do
{
arr.push_back(str); //每次全排列后插入字符串数组
}while(next_permutation(str.begin(),str.end())); //全排列
sort(arr.begin(),arr.end());//排序
arr.erase(unique(arr.begin(), arr.end()), arr.end());//去重
return arr;
}
};
京公网安备 11010502036488号