|
3 | 3 | importjava.util.ArrayList;
|
4 | 4 | importjava.util.List;
|
5 | 5 |
|
6 |
| -/** |
7 |
| - * 1286. Iterator for Combination |
8 |
| - * |
9 |
| - * Design an Iterator class, which has: |
10 |
| - * A constructor that takes a string characters of sorted distinct lowercase English letters and a number combinationLength as arguments. |
11 |
| - * A function next() that returns the next combination of length combinationLength in lexicographical order. |
12 |
| - * A function hasNext() that returns True if and only if there exists a next combination. |
13 |
| - * |
14 |
| - * Example: |
15 |
| - * CombinationIterator iterator = new CombinationIterator("abc", 2); // creates the iterator. |
16 |
| - * iterator.next(); // returns "ab" |
17 |
| - * iterator.hasNext(); // returns true |
18 |
| - * iterator.next(); // returns "ac" |
19 |
| - * iterator.hasNext(); // returns true |
20 |
| - * iterator.next(); // returns "bc" |
21 |
| - * iterator.hasNext(); // returns false |
22 |
| - * |
23 |
| - * Constraints: |
24 |
| - * 1 <= combinationLength <= characters.length <= 15 |
25 |
| - * There will be at most 10^4 function calls per test. |
26 |
| - * It's guaranteed that all calls of the function next are valid. |
27 |
| - * */ |
28 | 6 | publicclass_1286 {
|
29 | 7 | publicstaticclassSolution1 {
|
30 | 8 | publicstaticclassCombinationIterator {
|
|