Subset | Backtracking | C++
\nclass CombinationIterator {\npublic:\n    \n    vector<string> array; \n    int ptr = 0; \n    void helper(string &characters, string &temp, int index, int le
```\nclass CombinationIterator {\npublic:\n    \n    vector<string> array; \n    int ptr = 0; \n    void helper(string &characters, string &temp, int index, int len) {\n        \n        if(temp.length() == len) array.push_back(temp);\n        \n        for(int i = index; i < characters.length(); i++) {\n            temp += characters[i];\n            helper(characters, temp, i+1, len);\n            temp.pop_back(); \n        }\n        \n    }\n    CombinationIterator(string characters, int combinationLength) {\n        string temp = "";\n        helper(characters, temp, 0, combinationLength);\n        \n        sort(array.begin(), array.end());\n    }\n    \n    string next() {\n        return array[ptr++];\n    }\n    \n    bool hasNext() {\n        if(ptr < array.size()) return true; \n        return false; \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```\n
[]