package leetcode;

/**
 * https://leetcode.com/problems/detect-pattern-of-length-m-repeated-k-or-more-times/
 */
public class Problem1566 {
    public boolean containsPattern(int[] arr, int m, int k) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem1566 prob = new Problem1566();
        System.out.println(prob.containsPattern(new int[]{1,2,4,4,4,4}, 1, 3)); // true
        System.out.println(prob.containsPattern(new int[]{1,2,4,4,4,4}, 2, 2)); // true
        System.out.println(prob.containsPattern(new int[]{1,2,1,2,1,3}, 2, 3)); // false
        System.out.println(prob.containsPattern(new int[]{1,2,3,1,2}, 2, 2)); // false
        System.out.println(prob.containsPattern(new int[]{2,2,2,2}, 2, 3)); // false
    }
}

@@ -207,487 +207,421 @@
     
-// TODO%0A        return false
+for (int i = 0; i %3C= arr.length - m; i++) %7B%0A            int n = i
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1566 prob = new Problem1566();%0A        System.out.println(prob.containsPattern(new int%5B%5D%7B1,2,4,4,4,4%7D, 1, 3)); // true%0A        System.out.println(prob.containsPattern(new int%5B%5D%7B1,2,4,4,4,4%7D, 2, 2)); // true%0A        System.out.println(prob.containsPattern(new int%5B%5D%7B1,2,1,2,1,3%7D, 2, 3)); // false%0A        System.out.println(prob.containsPattern(new int%5B%5D%7B1,2,3,1,2%7D, 2, 2)); //
+    String prev = %22%22;%0A            boolean found = true;%0A            for (int j = 0; j %3C k; j++) %7B%0A                String s = %22%22;%0A                for (int l = 0; l %3C m && n %3C arr.length; l++) %7B%0A                    s += arr%5Bn++%5D;%0A                %7D%0A                if (!prev.isEmpty() && !s.equals(prev)) %7B%0A                    found =
  false
+;
 %0A   
@@ -629,84 +629,184 @@
     
-System.out.println(prob.containsPattern(new int%5B%5D%7B2,2,2,2%7D, 2, 3)); //
+            break;%0A                %7D%0A                prev = s;%0A            %7D%0A            if (found) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return
  false
+;
 %0A   

Solve problem 1566