[c++] video explanation
channel link>>>\nhttps://www.youtube.com/channel/UCkcMtAWv5PO1p6eal7TXoEw/\n\nclass CombinationIterator {\npublic:\n    vector<int> a;\n    vector<int> b;\n    
channel link>>>\nhttps://www.youtube.com/channel/UCkcMtAWv5PO1p6eal7TXoEw/\n```\nclass CombinationIterator {\npublic:\n    vector<int> a;\n    vector<int> b;\n    int stop;\n    string s;\n    int n;\n    CombinationIterator(string characters, int combinationLength) {\n        n = combinationLength;\n        int m = characters.size();\n        b.resize(n,0);\n        stop = -1;\n        s = characters;\n        for(int i = 0; i<n;i++)\n        {\n            a.emplace_back(i);\n        }\n        for(int i=n-1, j=m-1; i>=0;i--,j--)\n        {\n            b[i]=j;\n        }\n        if(m==n)\n            stop = 0;\n    }\n    \n    string next() {\n        string t;\n        for(int i = 0; i<a.size();i++)\n        {\n            t+=s[a[i]];\n        }\n        int i= a.size()-1;\n        bool bc=false;\n        for( ; i> stop; i--)\n        {\n            if(a[i]<b[i])\n            {\n                a[i]++;\n                bc=true;\n                if(i==stop+1 && a[i]==b[i])\n                {\n                    stop = i;\n                }\n                break;\n            }\n        }\n        if(!bc)\n        {\n            stop=n-1;\n        }\n        for(int j = i+1; j<a.size();j++)\n        {\n            a[j]= a[j-1]+1;\n        }\n        \n        return t;\n    }\n    \n    bool hasNext() {\n       \n        if(stop == n-1)\n            return false;\n\n        \n        return true;\n    }\n};\n\n/**\n * Your CombinationIterator object will be instantiated and called as such:\n * CombinationIterator* obj = new CombinationIterator(characters, combinationLength);\n * string param_1 = obj->next();\n * bool param_2 = obj->hasNext();\n */\n```
[]