title: Given an array of 0 and 1, find minimum no. of swaps to bring all 1s together (only adjacent swaps allowed)
body: <p>If given an array of 1's and 0's, what's good algorithm to show the minimum number of adjacent swaps needed to group all of the 1's together. The 1's don't need to be grouped at any specific place in the array. They just need to be grouped in whatever place provides for the minimum number of adjacent swaps.</p>
  
  <p>For example, if the array looks like this...</p>
  
  <p><code>1,0,0,1,1,0,1</code></p>
  
  <p>...the minimum number of adjacent swaps would be 3, because you'd center on index 4 and do the following swaps:</p>
  
  <ol>
  <li><p>Swap indices 0 and 1, resulting in:
  <code>0,1,0,1,1,0,1</code></p></li>
  <li><p>Swap indices 1 and 2, resulting in:
  <code>0,0,1,1,1,0,1</code></p></li>
  <li><p>Swap indices 5 and 6, resulting in:
  <code>0,0,1,1,1,1,0</code></p></li>
  </ol>
  
  <p>Anyone have a good algorithm for finding the minimum number of adjacent swaps for any array of 1's and 0's?</p>