✅C++ || EASY && STRAIGHTFORWARD || Pick-NotPick
\n\n\n\tclass CombinationIterator {\n\tpublic:\n\t\tvectorans;\n\t\tint j=0;\n\t\tvoid comb(int i,string& s,int k,string& t){\n\t\t\tif(i==s.size()){\n\t\t\t\ti
![image](https://assets.leetcode.com/users/images/2f0264cd-e642-49b4-8e54-6d48bdcfc4a3_1659772512.72693.png)\n\n\n\tclass CombinationIterator {\n\tpublic:\n\t\tvector<string>ans;\n\t\tint j=0;\n\t\tvoid comb(int i,string& s,int k,string& t){\n\t\t\tif(i==s.size()){\n\t\t\t\tif(t.size()==k) ans.push_back(t);\n\t\t\t\treturn;\n\t\t\t}\n\t//      Pick\n\t\t\tt.push_back(s[i]);\n\t\t\tcomb(i+1,s,k,t);\n\t\t\tt.pop_back();\n\t//      NotPick\n\t\t\tcomb(i+1,s,k,t);\n\t\t}\n\n\t\tCombinationIterator(string characters, int combinationLength) {\n\t\t\tsort(characters.begin(),characters.end());\n\t\t\tstring t="";\n\t\t\tcomb(0,characters,combinationLength,t);\n\t\t}\n\n\t\tstring next() {\n\t\t\treturn ans[j++];\n\t\t}\n\n\t\tbool hasNext() {\n\t\t\tif(j==ans.size())return false;\n\t\t\treturn true;\n\t\t}\n\t};
['C', 'C++']