C++ | MULTI-POINTER-HANDLING | IMPLEMENTATION
PLEASE UPVOTE IF U FIND MY SOLUTION HELPFUL :)\n\n\nclass CombinationIterator {\n    vector<int>v;\n    string S;\n    int N;\n    void update(int idx)\n    {\n
**PLEASE UPVOTE IF U FIND MY SOLUTION HELPFUL :)**\n\n```\nclass CombinationIterator {\n    vector<int>v;\n    string S;\n    int N;\n    void update(int idx)\n    {\n        if(++v[idx]!=N-(v.size()-idx-1))\n            return;\n        \n        if(idx==0)return;\n        update(idx-1);\n        v[idx]=1+v[idx-1];\n    }\npublic:\n    CombinationIterator(string characters, int combinationLength) {\n        v=vector<int>(combinationLength,0);\n        for(int i=0;i<combinationLength;i++)\n            v[i]=i;\n        S=characters;\n        N=characters.length();\n    }\n    \n    string next() {\n        string res;\n        for(auto &x:v)res+=S[x];\n        \n        update(v.size()-1);\n        return res;\n    }\n    \n    bool hasNext() {\n        return v[0]<=(N-v.size());\n    }\n};\n```
[]