LC073 - Set Matrix Zeroes
Problem
Given an m x n
integer matrix matrix
, if an element is 0
, set its entire row and column to 0
's. Must be in place.
Example
Input: matrix = [[1,1,1],[1,0,1],[1,1,1]]
Output: [[1,0,1],[0,0,0],[1,0,1]]
Solution
Time complexity of this solution is with extra space used for each zero in the matrix.
Last updated