题解 | #字符串的排列#

字符串的排列

http://www.nowcoder.com/practice/fe6b651b66ae47d7acce78ffdd9a96c7

class Solution {
public:
    vector<string> Permutation(string str)
    {
        vector<string> vans;
        sort(str.begin(), str.end()); 
        do{
            vans.emplace_back(str);
        }while(next_permutation(str.begin(), str.end()));
        return vans;
    }

};

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务