Rotting Oranges (LeetCode 994) | Full solution using DFS | Flood Fill algorithm
Nikhil Lohia
View ChannelAbout
I want to share with you my knowledge, that I have gained all my life. I like to see every task in your day to day life as an interesting problem to solve, and if you can understand the requirements, solving for it can become somewhat intuitive. I try to explore certain aspects of day to day life and how I can make them easier for you. This involves daily hacks, tutorials, innovations, new discoveries, experiences and all the stuff I find amusing. As a software engineer myself, I also believe that good problem solving skills can help you overcome most of the barriers in life. Programming is one of them. If you know how to approach a problem, writing a code for it in any language could be a very typical task. With this channel I aim to focus on the way to solve a problem efficiently rather than just its implementation.
Latest Posts
Video Description
Join this channel to get access to perks: https://www.youtube.com/channel/UCT-S2ngqEBoYCM5UKuNeELg/join Actual problem on LeetCode: https://leetcode.com/problems/rotting-oranges/description/ Chapters: 00:00 - Intro 00:53 - Problem Statement 02:21 - Understanding Visually 06:51 - What roadblocks? 09:27 - Approach multiple rotting oranges 17:04 - Dry run of Code 21:01 - Final Thoughts ๐ Links to topics I talk about in the video: Number of Islands: https://youtu.be/ZgCZfXPo3hI Depth First Search: https://youtu.be/bOrCi635kUw Breadth First Search: https://youtu.be/zfwHQNqszP4 Other Medium Problems: https://www.youtube.com/playlist?list=PLFdAYMIVJQHO1paovM-tu2vtGzQU72z_U ๐ A text based explanation is available at: https://studyalgorithms.com Code on Github: https://github.com/nikoo28/java-solutions/blob/master/src/main/java/leetcode/medium/RottingOranges.java Test-cases on Github: https://github.com/nikoo28/java-solutions/blob/master/src/test/java/leetcode/medium/RottingOrangesTest.java ๐ Reference Books: Starting Learn to Code: https://amzn.to/3sJm8Wl Favorite book to understand algorithms: https://amzn.to/4848xJH Favorite book for data structures: https://amzn.to/3P96YBv Get started for interview preparation: https://amzn.to/44Nn5du ๐ To see more videos like this, you can show your support on: https://www.buymeacoffee.com/studyalgorithms ๐ฅ My Recording Gear: Recording Light: https://amzn.to/3PdsViT Microphone: https://amzn.to/3Exv83x Recording Camera: https://amzn.to/3PwyN8e Tablet to sketch and draw: https://amzn.to/3ZdKVy7 Sketching Tool: https://amzn.to/45XJEgY Laptop to edit videos: https://amzn.to/460ofDu ๐ป Get Social ๐ป Follow on Facebook at: https://www.facebook.com/studyalgos Subscribe to RSS feeds: https://studyalgorithms.com/feed/ Join fan mail: http://eepurl.com/g9Dadv #leetcode #programming #interview
Coding Practice Must-Haves
AI-recommended products based on this video

Laptop Sleeve Case 11โ14 Inch MacBook Air MacBook Pro Surface Laptop Dell XPS 13 HP Envy Pavilion Lenovo Yoga Slim IdeaPad Acer Swift Chromebook Samsung Galaxy Book Shockproof Leather Bag Colour Blue

Gumdrop ProTech Case for Dell New XPS 13 Plus 9320 Laptop- Slim Lightweight Case with Energy Displacement Protection, Non-Skid Rubber Feet and Frosted Exterior for Bumps and Drops (Black)

65W 45W USB C Laptop Charger Compatible with Dell Latitude 5420 5430 5520 5530 7340 7430 Inspiron 14 16 XPS 13 Chromebook 3100 Dell Computer Type C Fast Charging AC Adapter Power Cord

Charger for Dell Computer Inspiron XPS Laptop 65W 45W Power Supply AC Adapter for Dell-Inspiron 15-3000 15-5000 15-7000 11-3000 13-5000 13-7000 17-5000 XPS 13 Series 5559 5558 5755 5758 Laptop Charger

Dell UltraSharp 24 Monitor - U2424H

Dell UltraSharp U2723QE 27" 4K UHD WLED LCD Monitor - 16:9 - Black, Silver EPEAT

Dell UltraSharp U2725QE 27' 4K Thunderbolt-Hub-Monitor mit Bildwiederholfrequenz Von 120Hz

Logitech G305 LIGHTSPEED Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

Logitech M185 Wireless Mouse, 2.4GHz with USB Mini Receiver, 12-Month Battery Life, 1000 DPI Optical Tracking, Ambidextrous, Compatible with PC, Mac, Laptop - Black

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

Logitech G435 Lightspeed and Bluetooth Wireless Gaming Headset - Lightweight Over-Ear Headphones, Built-in mics, 18h Battery, Compatible with Dolby Atmos, PC, Mobile - Black

CORSAIR iCUE Link XD5 RGB Elite LCD Pump-Reservoir Unit - D5 PWM Pump - 480x480 IPS LCD Screen - 22 Addressable RGB LEDs - 440ml Nylon Reservoir - White

CORSAIR iCUE Link XC7 RGB Elite CPU Water Block - Transparent Flow Chamber - 24 RGB LEDs - Fits Intelยฎ LGA 1700, AMDยฎ AM5 and Older - White

CORSAIR Hydro X Series iCUE Link XH405i Custom Cooling Kit โ Hardline Water Cooling Loop โ XC7 Elite CPU Water Block โ XD5 Elite D5 Pump Res โ XR5 360mm Radiator โ 3X QX120 RGB Fans

Amazon Basics Clear Thermal Laminating Plastic Paper Laminator Sheets, 9 x 11.5-Inch, 200-Pack, 3mil

Amazon Basics 9 Volt Everyday Alkaline Battery - Pack of 8 The Nordic Swan Ecolabel

Amazon Basics 48 Pack AA High-Performance Alkaline Batteries, 10-Year Shelf Life, Easy to Open Value Pack The Nordic Swan Ecolabel

Amazon Basics 64GB microSDXC Memory Card with Full Size Adapter, 100MB/s, U3, 2-Pack

NEEWER Advanced 18 inch LED Ring Light for Phone, LCD Touch Screen, 2.4G Remote Lights Control, 3200-5600K, Tripod Light for iPhone Action Camera, for Studio Makeup TikTok YouTube Video Salon (Black)

Razer BlackShark V2 X Gaming Headset: 50mm Drivers - Cardioid Mic - Memory Foam Cushion - Lightweight- Comfortable, Noise Isolating Earcups - for PC, PS4, PS5, Switch - 3.5mm Audio Jack - Black ECOLOGO

12V/24V 100W Car Laptop Charger USB C for Lenovo Thinkpad MacBook HP Dell Acer Asus,Google,MSI, LG, Samsung,Huawei,Surface pro 9 8, Razer, Chromebook, ROG Ally, Steam Deck and All Type-C Devices




