title: Which row has the most 1s in a 0-1 matrix with all 1s "on the left"?
body: <p><strong>Problem</strong></p>
  
  <p>Each row of an n x n matrix consists of 1's and 0's such that in any row, all 1's come before any 0's. Find row containing most no of 1's in O(n).</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>1 1 1 1 1 0  &lt;- Contains maximum number of 1s, return index 1
  1 1 1 0 0 0
  1 0 0 0 0 0
  1 1 1 1 0 0
  1 1 1 1 0 0
  1 1 0 0 0 0
  </code></pre>
  
  <p>I found this question in my algorithms book. The best I could do took O(n logn) time. 
  How to do this in O(n)?</p>