Given a matrix, A of size M x N of 0's and 1's. If an element is 0, set its entire row and column to 0.

Problem Note

  • Solve this problem in-place.

Example 1

Input:
     [ [1, 0, 1],
       [1, 1, 1], 
       [1, 1, 1] ]
Output:
     [ [0, 0, 0],
       [1, 0, 1],
       [1, 0, 1] ]

Example 2

Input:
     [ [1, 0, 1],
       [1, 1, 1],
       [1, 0, 1] ]

Output:
     [ [0, 0, 0],
       [1, 0, 1],
       [0, 0, 0] ]