leetcode 剑指 Offer 38. 字符串的排列

在这里插入图片描述

class Solution {
public:
    vector<string> permutation(string s) {
        vector<string> res;
        sort(s.begin(),s.end());
        do{
            res.push_back(s);
        }while(next_permutation(s.begin(),s.end()));
        return res;
    }
};

猜你喜欢

转载自blog.csdn.net/weixin_43956456/article/details/107721062