题解 | #字符串的排列#

字符串的排列

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

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

next_permutation自动去重

全部评论

相关推荐

点赞 评论 收藏
分享
陆续:不可思议 竟然没那就话 那就我来吧 :你是我在牛客见到的最美的女孩
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务