Are there any better methods to do permutation of string?

前端 未结 20 1639
醉话见心
醉话见心 2020-11-27 11:15
void permute(string elems, int mid, int end)
{
    static int count;
    if (mid == end) {
        cout << ++count << \" : \" << elems << end         


        
20条回答
  •  伪装坚强ぢ
    2020-11-27 11:52

    Here's one I just rustled up!!

    void permute(const char* str, int level=0, bool print=true) {
    
        if (print) std::cout << str << std::endl;
    
        char temp[30];
        for (int i = level; i

提交回复
热议问题