Python sol by built-in combinations
Python sol by built-in combinations\n\n---\n\nImplementation:\n\n\nfrom itertools import combinations\n\nclass CombinationIterator:\n\n    def __init__(self, ch
Python sol by built-in combinations\n\n---\n\n**Implementation**:\n\n```\nfrom itertools import combinations\n\nclass CombinationIterator:\n\n    def __init__(self, characters: str, combinationLength: int):\n        self.comb = [ *combinations(characters, combinationLength)]\n        self.idx = 0\n        \n    def next(self) -> str:\n        \n        answer = \'\'.join( self.comb[self.idx] )\n        self.idx += 1\n        return answer\n        \n\n    def hasNext(self) -> bool:\n        \n        if self.idx != len(self.comb):\n            return True\n        \n        else:\n            return False\n```\n\n---\n\n**Implementation** by man-made combinations:\n\n```\nclass CombinationIterator:\n\n    def __init__(self, characters: str, combinationLength: int):\n        \n        source = [*characters]\n\n        # -----------------------------------\n        def dfs(cur_comb, src, result):\n            \n            if len(cur_comb) == combinationLength:\n                result.append( cur_comb )\n                return result\n                \n            for idx, char in enumerate(src):\n                src[0], src[idx] = src[idx], src[0]\n                \n                dfs(cur_comb+src[0], src[idx+1:], result)\n                \n                src[0], src[idx] = src[idx], src[0]\n                \n            return result\n        # -----------------------------------\n        self.combination = dfs(cur_comb=\'\', src=source, result=[])\n        self.idx = 0\n        \n        \n\n    def next(self) -> str:\n        \n        next_comb =  self.combination[self.idx]\n        self.idx += 1\n        return next_comb\n    \n        \n\n    def hasNext(self) -> bool:\n        \n        if self.idx == len(self.combination):\n            return False\n        \n        else:\n            return True\n\n```\n\n---\n\n\nReference:\n\n[1] P[ython official docs about itertools.combinations( ... )](https://docs.python.org/3/library/itertools.html#itertools.combinations)
['Python', 'Python3']