package leetcode;

/**
 * https://leetcode.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k/
 */
public class Problem1461 {
    public boolean hasAllCodes(String s, int k) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem1461 prob = new Problem1461();
        System.out.println(prob.hasAllCodes("00110110", 2)); // true
        System.out.println(prob.hasAllCodes("00110", 2)); // true
        System.out.println(prob.hasAllCodes("0110", 1)); // true
        System.out.println(prob.hasAllCodes("0110", 2)); // false
        System.out.println(prob.hasAllCodes("0000000001011100", 4)); // false
    }
}

@@ -12,16 +12,65 @@
 tcode;%0A%0A
+import java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 /**%0A * h
@@ -246,479 +246,193 @@
     
-// TODO%0A        return false;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1461 prob = new Problem1461();%0A        System.out.println(prob.hasAllCodes(%2200110110%22, 2)); // true%0A        System.out.println(prob.hasAllCodes(%2200110%22, 2)); // true%0A        System.out.println(prob.hasAllCodes(%220110%22, 1)); // true%0A        System.out.println(prob.hasAllCodes(%220110%22, 2)); // false%0A        System.out.println(prob.hasAllCodes(%220000000001011100%22, 4)); // false
+Set%3CString%3E set = new HashSet%3C%3E();%0A        for (int i = 0; i %3C= s.length() - k; i++) %7B%0A            set.add(s.substring(i, i + k));%0A        %7D%0A        return set.size() == Math.pow(2, k);
 %0A   

Solve problem 1461