O(1) sapce, using bitmap. no recursion
we can find out the key "abcd", the Combination sequence  just like follows:\n\nab\nac\nad\nbc\nbd\n\nwe can using a hex num to encode each of the Combination s
+ we can find out the key "abcd", the Combination sequence  just like follows:\n```\nab\nac\nad\nbc\nbd\n```\nwe can using a hex num to encode each of the Combination string:\n```\n1100\n1010\n1001\n0110\n0101\n0011\n```\n+ we just using the descending order of numbers to get  the result, we can count the number of 1 in each keys.\n\n```c++\nclass CombinationIterator {\npublic:\n    CombinationIterator(string characters, int combinationLength) {\n        reverse(characters.begin(),characters.end());\n        this->key = characters;\n        this->curr = (1<<key.size())-1;\n        this->sz = combinationLength;\n    }\n    \n    int countOne(int n){\n        int count = 0;\n        while (n != 0){\n            count++;\n            n = (n-1) & n;\n        }\n        return count;\n    }\n    \n    string next() {    \n        while(curr >= 0&&countOne(curr) != sz){curr--;}\n        string res;\n        for(int i = 0; i < key.size(); ++i){\n            if((curr&(1<<i))>>i){res = key[i] + res;}\n        }\n        curr--;\n        return res;\n    }\n\n    bool hasNext() {  \n        while(curr >= 0&&countOne(curr) != sz){curr--;}\n        if(curr < 0){return false;}\n        return true;\n    }\nprivate:\n    int curr;\n    int sz;\n    string key;\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
[]