Java-bitmap-space-O(1)
\nclass CombinationIterator {\n   // \u539F\u5B57\u7B26\u4E32\u53D6\u53CD\n    String originReverse;\n    int encode;\n    int len;\n\n    public CombinationIte
```\nclass CombinationIterator {\n   // \u539F\u5B57\u7B26\u4E32\u53D6\u53CD\n    String originReverse;\n    int encode;\n    int len;\n\n    public CombinationIterator(String characters, int combinationLength) {\n      //\n      originReverse = new StringBuffer(characters).reverse().toString();\n      encode = (1 << characters.length()) - 1;\n      len = combinationLength;\n    }\n\n    public String next() {\n      desc();\n      String res = "";\n      for (int i = 0; i < originReverse.length(); ++i) {\n        // \u5224\u65AD encode \u7684\u4E8C\u8FDB\u5236\u7F16\u7801\u7684\u4ECE\u53F3\u5F80\u5DE6\u6570\u7B2C i \u4F4D \u662F\u5426\u662F 1\n        if (((encode & (1 << i)) >> i) == 1) {\n          res = originReverse.charAt(i) + res;\n        }\n      }\n      encode--;\n      return res;\n    }\n\n    public boolean hasNext() {\n      desc();\n      return encode >= 0;\n    }\n\n    private void desc() {\n      // encode \u5927\u4E8E\u7B49\u4E8E0\uFF0C\u540C\u65F6 encode \u7684 1 \u7684\u4E2A\u6570\u4E0D\u7B49\u4E8Elen\u3002\n      // \u76EE\u7684\u662F \u627E\u5230\u4E0B\u4E00\u4E2Aencode\n      while (encode >= 0 && Integer.bitCount(encode) != len) {\n        encode--;\n      }\n    }\n}\n\n```
[]