Given an m x n matrix. If an element is 0, set its entire row and column to 0. Do it in-place.
Example 1:
1 | Input: matrix = [[1,1,1],[1,0,1],[1,1,1]] |
Example 2:
1 | Input: matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]] |
找0的位置,行列都設0。
1 | T: O(nˆ2), S: O(n) |
如果你覺得這篇文章很棒,請你不吝點讚 (゚∀゚)