Back to Browse

Rotting Oranges | Directional Arrays & BFS | LeetCode

6.5K views
Mar 16, 2022
14:55

Rotting Oranges is a popular LeetCode problem asked by Amazon and Microsoft. For this problem, we are given an integer matrix containing only 0's, 1's, and 2's representing an empty cell, a fresh orange, and a rotten orange respectively. The intuition to solve this problem with BFS is that it mentions a grid as input, finding a minimum, and having very small constraints. Solving this problem with a breadth first search leads is the most optimal approach using a queue and directional arrays. 🎥 Graph Problem Tips Video: https://youtu.be/tMSdjPKFRD4 Check out my interview prep platform for learning the patterns! 📢 Interview Prep Platform: https://algoswithmichael.com 🔗 Social 🔗 🎧 Join the community Discord: https://discord.gg/aVWsAaaCtT 💰 Support me on Patreon: https://www.patreon.com/michaelmuinos 🔗Follow me on LinkedIn: https://www.linkedin.com/in/michael-muinos 📂Follow me on Github: https://github.com/MichaelMuinos

Download

1 formats

Video Formats

360pmp417.9 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Rotting Oranges | Directional Arrays & BFS | LeetCode | NatokHD