C++ Generate Combinations | EASY Intuitive Solution
\nclass CombinationIterator {\npublic:\n  int n;\n  string arr;\n  set<string> st;\n  void solve(int i, int len, string curr) {\n    if (i >= n) {\n      if (cu
```\nclass CombinationIterator {\npublic:\n  int n;\n  string arr;\n  set<string> st;\n  void solve(int i, int len, string curr) {\n    if (i >= n) {\n      if (curr.length() == len)\n        st.insert(curr);\n      return;\n    }\n    solve(i + 1, len, curr);\n    curr += arr[i];\n    solve(i + 1, len, curr);\n    return;\n  }\n  CombinationIterator(string characters, int len) {\n    arr = characters;\n    n = characters.size();\n    solve(0, len, "");\n    return;\n  }\n  string next() {\n    auto fnd = st.begin();\n    string ans = *fnd;\n    st.erase(fnd);\n    return ans;\n  }\n\n  bool hasNext() { return st.size(); }\n};\n```
['Backtracking', 'Sorting', 'Ordered Set']