Amazon Coding Interview Question - 0 1 Matrix - LeetCode 542

preview_player
Показать описание


Step by step walk through of the solution to the popular Amazon coding interview question, 0 1 Matrix.

LeetCode 542

JavaScript

0:00 Intro
0:55 Explanation
4:36 Code

#softwareengineering #javascript #leetcode
Рекомендации по теме
Комментарии
Автор

thx man this is the easiest one to understand out of all the ones that i've watched

danielk
Автор

One note is that this solution will add duplicate coordinates to the queue

rachelwilliams
Автор

Thank you for making these videos. Keep up the good work.

rydog
Автор

This was the best explanation. Thank you!

rachelwilliams
Автор

Thank you for this! Your videos are a ton of help. Quick question:

I'm having a hard time understanding the need to convert non-0's into infinity. Would it not work if you were to just compare if mat[x][y] was greater than 0?

Also, how does it know to skip over duplicates in the queue? Like when we've already encountered an Infinity that we've already pushed to the queue?

ethanayaay
Автор

You explained it well.

This question was so unintuitive for me, i was trying bfs from the 1 and of course got tle. What was the clue that makes you realise "i need to bfs from 0's, it's much more efficient"

benpurcell
Автор

you gotta show what made you decide to choose a queue.

tamzidahmed
welcome to shbcf.ru