Given a two-dimensional m*n matrix, if an element is 0, then all elements of its row and column are set to 0. Additional space is not allowed.
Just see this problem, only think of open two arrays, one to record the row to be set to 0, one to record the column to be set to 0, but this need to use extra space. The solution in the book, using an existing array, first find a bit 0 element, record the row and column location, and then in the subsequent scanning process, if an element is 0, then the first 0 row and the column position of this element is set to 0, the first column of 0 and the position of this element's row is set to 0, the second scan , skipping the first row with the column element, if an element in the first 0 element of the row with this element of the column or the first 0 element of the column with this element's row position is 0, set this element to 0, and finally the row and column of the first 0 element are all 0.
Matrix 0--Enter Silicon Valley