Given an m x n integer matrix, if an element is 0, set its entire row and column to 0's. You must do it in-place with O(1) space complexity.
O(1) Space In-place Modification
We use the first row and first column of the matrix itself as storage for our markers. This allows us to avoid O(m+n) extra space. We just need two extra variables to track if the first row and column themselves should be zeroed.