Code RoomZero matrix rows and columns
MediumPrep Room Coding #1002

Zero matrix rows and columns

CodingAlgorithms & data structuresMid–Senior~25 min

Given an m x n matrix, if any cell is 0 set its entire row and entire column to 0, in place, using O(1) extra space (do not allocate row/column marker arrays — encode the markers within the matrix's own first row and first column). Return the modified matrix. Dimensions up to 200 x 200.

Implement
set_zeroes(matrix: list[list[int]]) → list[list[int]]
Examples
in[[[1,1,1],[1,0,1],[1,1,1]]]out[[1,0,1],[0,0,0],[1,0,1]]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 25 min
InputExpectedGot
[[[1,1,1],[1,0,1],[1,1,1]]][[1,0,1],[0,0,0],[1,0,1]]not run yetsample