File tree 1 file changed +0
-22
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-22
lines changed Original file line number Diff line number Diff line change 3
3
import java .util .ArrayList ;
4
4
import java .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
public class _1286 {
29
7
public static class Solution1 {
30
8
public static class CombinationIterator {
You can’t perform that action at this time.
0 commit comments