title: what are the Number of states for the array with 0's and 1's
body: <p>Given an array with just 0's and 1's.</p>
  
  <p>If a <code>0</code> is left of a <code>1</code> then they swap theirs values</p>
  
  <p>count the number of steps to take all 0's to the right of the array.</p>
  
  <p><b>EXAMPLE1</b>
  if array=[0 1 0 0 1 0 1 0 1]</p>
  
  <pre><code>[1 0 0 1 0 1 0 1 0]
  
  [1 0 1 0 1 0 1 0 0]
  
  [1 1 0 1 0 1 0 0 0]
  
  [1 1 1 0 1 0 0 0 0]
  
  [1 1 1 1 0 0 0 0 0]
  
  the Answer is ```5``` steps.
  </code></pre>
  
  <p><b>EXAMPLE2</b>
  if array=[0 1 0 1 0]</p>
  
  <pre><code>[1 0 1 0 0]
  
  [1 1 0 0 0]
  </code></pre>
  
  <p>The Answer= <code>2</code></p>
  
  <p>I wrote code to do what is asked. But its very slow for large size of the array :( pls help</p>