title: Median of a Matrix with sorted rows
body: <p>I am not able to solve the following problem optimally nor finding an approach to do this anywhere.</p>
  
  <blockquote>
    <p>Given a N × M matrix in which each row is sorted, find the overall median of the matrix. Assume N*M is odd.</p>
    
    <p>For example,  </p>
    
    <p>Matrix =<br>
    [1, 3, 5]<br>
    [2, 6, 9]<br>
    [3, 6, 9]  </p>
    
    <p>A = [1, 2, 3, 3, 5, 6, 6, 9, 9]  </p>
    
    <p>Median is 5. So, we return 5.<br>
    Note: No extra memory is allowed.</p>
  </blockquote>
  
  <p>Any help will be appreciated.</p>