Search⌘ K
AI Features

Solution: 01 Matrix

Solution: 01 Matrix gives a binary matrix and asks you to return a matrix containing each cell’s distance to its nearest zero, counting each horizontal or vertical move as one.

Statement

Given an m×nm \times n binary matrix, mat, find the distance from each cell to the ...