Notes

Personal notes on various topics

View on GitHub

Set Matrix Zeroes

Problem Statement

Given an m x n integer matrix, your task is to set the entire row and column to zero if any element in the matrix is zero. The operation must be performed in place.

Examples

Example 1:

Example 1

Example 2:

Example 2

Constraints

Follow Up

Code Template

class Solution:
    def setZeroes(self, matrix: List[List[int]]) -> None:
        # Your code here
        pass

Solutions

Back to Problem List Back to Categories