package leetcode;

/**
 * https://leetcode.com/problems/iterator-for-combination/
 */
public class Problem1286 {
    private static class CombinationIterator {
        public CombinationIterator(String characters, int combinationLength) {
            // TODO
        }

        public String next() {
            // TODO
            return null;
        }

        public boolean hasNext() {
            // TODO
            return false;
        }
    }

    public static void main(String[] args) {
        CombinationIterator iter = new CombinationIterator("abc", 2);
        System.out.println(iter.next()); // returns "ab"
        System.out.println(iter.hasNext()); // returns true
        System.out.println(iter.next()); // returns "ac"
        System.out.println(iter.hasNext()); // returns true
        System.out.println(iter.next()); // returns "bc"
        System.out.println(iter.hasNext()); // returns false
    }
}

@@ -444,24 +444,386 @@
    %7D%0A    %7D%0A%0A
+    private static void nextCombination(String str, int length, int index, String accu) %7B%0A        if (accu.length() == length) %7B%0A            System.out.println(accu);%0A            return;%0A        %7D%0A        for (int i = index; i %3C str.length(); i++) %7B%0A            char c = str.charAt(i);%0A            nextCombination(str, length, i + 1, accu + c);%0A        %7D%0A    %7D%0A%0A
     public s
@@ -851,24 +851,26 @@
 g%5B%5D args) %7B%0A
+//
         Comb
@@ -927,16 +927,18 @@
 c%22, 2);%0A
+//
         
@@ -986,16 +986,18 @@
 ns %22ab%22%0A
+//
         
@@ -1040,32 +1040,34 @@
 // returns true%0A
+//
         System.o
@@ -1107,16 +1107,18 @@
 ns %22ac%22%0A
+//
         
@@ -1169,16 +1169,18 @@
 ns true%0A
+//
         
@@ -1228,16 +1228,18 @@
 ns %22bc%22%0A
+//
         
@@ -1290,16 +1290,61 @@
 ns false
+%0A%0A        nextCombination(%2212345%22, 3, 0, %22%22);
 %0A    %7D%0A%7D

Update problem 1286