title: How to find maximum number of groups needed to sort an Array?
body: <p>Suppose I had an array: </p>
  
  <pre><code>[1, 8, 5, 6, 10, 9, 11, 12];
  </code></pre>
  
  <p>I want to sort it by ascending order, but find out the maximum groups I would need to sort. In this example, the answer would be: </p>
  
  <pre><code>[1], [8,5,6], [10,9], [11], [12]: so 5
  </code></pre>
  
  <p>[3, 2, 1] would come out to be 1 because the entire array would need sorting.</p>
  
  <p>I am at a complete loss of how to do this a nudge in the right direction would be greatly appreciated. </p>