题目
LeetCode 1286.字母组合迭代器
解释
## 题目描述
请你设计一个迭代器类 CombinationIterator ,包括以下内容:
CombinationIterator(string characters, int combinationLength) 一个构造函数,输入参数包括:用一个 有序且字符唯一 的字符串 characters(该字符串只包含小写英文字母)和一个数字 combinationLength 。
函数 next() ,按 字典序 返回长度为 combinationLength 的下一个字母组合。
函数 hasNext() ,只有存在长度为 combinationLength 的下一个字母组合时,才返回 true
## 示例
**示例 1:**
**输入:** ["CombinationIterator", "next", "hasNext", "next", "hasNext", "next", "hasNext"]
[["abc", 2], [], [], [], [], [], []]
**输出:** [null, "ab", true, "ac", true, "bc", false]
**解释:** CombinationIterator iterator = new CombinationIterator("abc", 2); // 创建迭代器 iterator
iterator.next(); // 返回 "ab"
iterator.hasNext(); // 返回 true
iterator.next(); // 返回 "ac"
iterator.hasNext(); // 返回 true
iterator.next(); // 返回 "bc"
iterator.hasNext(); // 返回 false
## 约束条件
1 <= combinationLength <= characters.length <= 15
characters 中每个字符都 不同
每组测试数据最多对 next 和 hasNext 调用 104次
题目保证每次调用函数 next 时都存在下一个字母组合。
## LeetCode 链接
https://leetcode.cn/problems/iterator-for-combination/
答案
正在疯狂整理答案中......
