Flood Fill & Grid Graphs

Implicit graphs, 4/8-connectivity, island counting, and boundary fill problems.

32 lessons
96 min

Lessons

1. Intro

Theory vs Practice

2m

2. The Paint Bucket

Visualizing Flood Fill

2m

3. Counting Islands

From Pixels to Geography

2m

4. Dependencies and Cycles

The Impossible Schedule

2m

5. Cycle Detection - The Logic

DFS Recursion Stack

4m

6. The Three Colors

State Management

4m

7. Cycle Detection - Visualizing

Walking the path

3m

8. Quiz: Grid Graph Traversal

Knowledge check

2m1 problems

9. Not Every Grid Needs Traversal

Counting vs exploring

3m

10. Quiz: Cycle Detection in Directed Graphs

Knowledge check

2m1 problems

11. LeetCode 733 Flood Fill - Problem Statement

LeetCode 733

2m1 problems

12. LeetCode 733 Flood Fill - Strategy

DFS or BFS?

3m

13. LeetCode 733 Flood Fill - Why It Works

The Chain Reaction

3m

14. LeetCode 733 Flood Fill - Implementation

Coding the Solution

5m1 problems

15. LeetCode 200 Number of Islands - Problem Statement

LeetCode 200

2m1 problems

16. LeetCode 200 Number of Islands - Core Idea

Find and Erase

3m

17. LeetCode 200 Number of Islands - Visualization

Sinking the Island

3m

18. LeetCode 200 Number of Islands - Implementation

Coding the Sinking Strategy

6m1 problems

19. Quiz: Island Counting Logic

Knowledge check

2m1 problems

20. LeetCode 463 Island Perimeter - Problem Statement

LeetCode 463

2m1 problems

21. LeetCode 463 Island Perimeter - Core Idea

Count exposed edges

3m

22. LeetCode 463 Island Perimeter - Algorithm

Count, do not traverse

4m

23. LeetCode 463 Island Perimeter - Implementation

Edge counting code

5m1 problems

24. LeetCode 463 Island Perimeter - Lessons

Not all grid problems need DFS

3m

25. Quiz: Perimeter vs Area

Knowledge check

2m1 problems

26. LeetCode 695 Max Area of Island - Problem Statement

DFS with size tracking

6m1 problems

27. LeetCode 695 Max Area of Island - Core Idea

DFS returns size

3m

28. LeetCode 695 Max Area of Island - Algorithm

Recursive area calculation

4m

29. LeetCode 695 Max Area of Island - Implementation

LeetCode 695

2m1 problems

30. LeetCode 695 Max Area of Island - Lessons

DFS as a calculator

3m

31. Quiz: Flood Fill Boundaries

Knowledge check

2m1 problems

32. Section Recap

What we learned

2m

Practice Problems

1.
2.
Surrounded RegionsLeetCodemedium
4.
Shortest BridgeLeetCodemedium
5.
Count Sub IslandsLeetCodemedium
6.
Coloring A BorderLeetCodemedium
7.
8.
MazeCodeforcesmedium
9.
LabyrinthCodeforcesmedium
10.
Solve the MazeCodeforcesmedium
11.
Ice CaveCodeforceseasy
12.
FairCodeforcesmedium
13.
Police StationsCodeforceshard

Ready to start learning?

Access all 32 lessons with interactive content and progress tracking.