title: How to find repeating sequence of Integers in an array of Integers?
body: <p>How to find repeating sequence of Integers in an array of Integers?</p>
  
  <p>00 would be repeating, so would 123123, but 01234593623 would not be.</p>
  
  <p>I have an idea to how to do this, but it is blurry in my mind, and my implementation doesn't go far due to this.</p>
  
  <p>My idea was</p>
  
  <ol>
  <li>Offset by a certain amount each time going through a for loop</li>
  <li>Loop through inside of that and compare chunks of numbers by that offset</li>
  </ol>
  
  <p>In Java, I got this far:</p>
  
  <pre><code>    String[] p1 = new String[nDigitGroup];
      String[] p2 = new String[nDigitGroup];
  
      for (int pos = 0; pos &lt; number.length - 1; pos++)
      {
          System.out.println("HERE: " + pos + (nDigitGroup - 1));
          int arrayCounter = -1;
  
          for (int n = pos; n &lt; pos + nDigitGroup ; n++)
          {
              System.out.printf("\nPOS: %d\nN: %d\n", pos, n);
              arrayCounter++;
              p1[arrayCounter] = number[n];
  
              System.out.println(p1[arrayCounter]);
          }
  
          pos += nDigitGroup;
          arrayCounter = -1;
  
          System.out.println("SWITCHING");
  
          for (int n = pos; n &lt; pos + nDigitGroup ; n++)
          {
              System.out.printf("\nPOS: %d\nN: %d\n", pos, n);
              arrayCounter++;
              p2[arrayCounter] = number[n];
  
              System.out.println(p2[arrayCounter]);
          }
  
          if (p1[0].equals(p2[0]) &amp;&amp; p1[1].equals(p2[1])) System.out.println("MATCHING");
      }
  </code></pre>
  
  <p>When ran with these arguments:</p>
  
  <pre><code>        repeatingSeqOf(2, new String[] {"1", "2", "3", "4", "5", "6", "7", "7" });
  </code></pre>
  
  <p>I am correctly filling the section arrays, but it breaks on an index out of bounds exception.</p>