方法之一next_permutationCPP提供了内置函数next_permutation实现全排列,但需要对原数组进行排序。 class Solution { public: vector Permutation(string str) { string path; vector res; sort(str.begin(), str.end()); do{ for(int i = 0; i < str.size(); i++){ path += str[i]; } res.emplace_back(path); path.erase(path.begin(), path.end())...