Zero Matrix Best Time & Space Solution
Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column are set to 0. To achieve the best time complexity of O(M*N) and space complexity of O(1), you can use the following algorithm: