title: Finding the most Repetitive number using Divide and Conquer approach?
body: <p>I have an integer arrayList which is <em>5, 12, 5, 17, 5, 5, 5, 39</em> and I tried to find the <strong>most repeating</strong> number and it works which will print <strong>5</strong>.</p>
  
  <p>However, I want to write it by using divide and conquer approach. </p>
  
  <p>Any tips would be helpful (pseudocode, Java code or any help...)</p>
  
  <pre><code>public static void main(String[] args) {
  
          int[] repetitive = { 5, 12, 5, 17, 5, 5, 5, 39 };
          int counter = 1;
          int temp = 0;
          int checker = 1;
  
          Arrays.sort(repetitive);
          int cont = repetitive[0];
  
          for (int i = 1; i &lt; repetitive.length; i++) {
              if (repetative[i] == repetitive[i - 1] &amp;&amp; cont == repetitive[i]) {
                  counter++;
                  temp = repetitive[i];
  
              } else if (repetitive[i] == repetitive[i - 1]) {
                  checker++;
  
                  if (checker &gt; counter) {
                      temp = repetitive[i];
                  } else if (repetitive[i] != repetitive[i - 1]) {
                      checker = 1;
                  }
              }
          }
  
          System.out.println(temp);
      }
  </code></pre>