Skip to main content
All Questions

01 Matrix

Unlock detailed company stats for this questionUpgrade
Given an M x N binary matrix, calculate the distance of each cell to the nearest 0. Return a new matrix where each cell contains this distance.

Community answers

No answers contributed by the community yet.

Related questions

Set Matrix Zeroes

Related courses

Course

Machine Learning Engineer Interview Prep

Land your dream machine learning role at Meta, Google, Amazon, Apple, Microsoft, Nvidia, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Explore ML system design, core concepts, coding, behavioral interviews, and more.

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.