title: space and time optimized algorithm for finding rows and columns with atleast single '1'
body: <p>For a given  matrix NxN having 0 or 1′s  only. find the count of rows and columns where at least one 1 occurs.</p>
  
  <p>e,g</p>
  
  <p>0 0 0 0</p>
  
  <p>1 0 0 1</p>
  
  <p>1 0 0 1</p>
  
  <p>1 1 0 1</p>
  
  <p>Row count having 1 at least once: 3</p>
  
  <p>Col count having 1 at least once: 3</p>
  
  <p>Mind is frozen can not think of any way better than normal double for loops giving me O(n^2) 
  looking forward to some help</p>