LC 73 — Problem

Given an m x n integer matrix, if an element is 0, set its entire row and column to 0. Do it in place.

Input: matrix = 111,101,111
Output: 101,000,101
Input: matrix = 0120,3452,1315
Output: 0000,0450,0310

Constraints: m, n ∈ [1, 200] · matrix[i][j] ∈ [-2⁹, 2⁹ - 1]

Follow up: Can you do it with O(1) extra space?

Given a matrix, if an element is 0, set its entire row and column to 0. Sounds straightforward — find the zero and zero its row and column. Try it.

FIG. 1 — TAP CELLS IN ROW 1 AND COLUMN 1 TO ZERO THEM