title: Finding Squares on the chessboard attackable by a rook
body: <p>The question is like this..</p>
  
  <p>There is an NxN chessboard. Each square on the chessboard can be either empty or can have a rook. A rook as we know can attack either horizontally or vertically. Given a 2D matrix where 0 represents an empty square and 1 represents a rook, we have to fill in all the cells in the matrix with 1 which represent squares that can be attacked by any rook present on the chessboard.</p>
  
  <p>Now, I could do this easily in O(n^3) time and constant space complexity. And then in O(n^2) time and O(2*n) space complexity. But I need to figure out a solution in O(n^2) time and constant space. Somebody please help.</p>