Day 168 of LeetCode π§
Word Ladder (BFS)
Build pattern graph:
hot β *ot, h*t, ho*
The graph construction is the real challenge.
#LeetCode#Python#DSA
Day 164 of LeetCode π§
Surrounded Regions (DFS)
Mark border-connected O's first.
Then flip the remaining O β X.
Nice DFS grid problem.
#LeetCode#Python#DSA
Day 163 of LeetCode π§
Pacific Atlantic Water Flow (DFS)
DFS from the ocean boundaries.
Find cells reachable by both oceans.
The trick is thinking in reverse.
#LeetCode#Python#DSA
Day 162 of LeetCode π§
Rotting Oranges (BFS)
Queue all rotten oranges first,
then spread in all 4 directions.
Multi-source BFS pattern.
#LeetCode#Python#DSA
Day 161 of LeetCode π§
Clone Graph (DFS)
Hashmap: original node β cloned node.
DFS through neighbors and reuse existing clones.
#LeetCode#Python#DSA
Day 160 of LeetCode π§
Max Area of Island (DFS)
Traverse island β calculate area β keep max.
Same DFS pattern, different goal.
#LeetCode#Python#DSA
Day 159 of LeetCode π§
Number of Islands (DFS)
Busy day.
Revisiting grid traversal, directions, and visited tracking.
Fundamentals matter.
#LeetCode#Python#DSA
Day 158 of LeetCode π§
Binary Tree Right Side View
BFS level traversal.
Store the last node from each level.
Busy day, still showed up.
#LeetCode#Python#DSA
Day 157 of LeetCode π§
Busy day.
Revised Binary Tree Level Order Traversal.
Queue BFS level-by-level processing.
Keeping the streak alive.
#LeetCode#Python#DSA
Day 156 of LeetCode π§
Number of Provinces (DFS)
Visit city β explore neighbors β mark visited.
Connected components in action.
#LeetCode#Python#DSA
Day 155 of LeetCode π§
Max Area of Island (DFS)
Not easy to come up with on my own,
but it felt great when it finally clicked π
DFS area counting max tracking.
#LeetCode#Python#DSA
Day 154 of LeetCode π§
Number of Islands (DFS)
Find land β DFS β mark visited β count island.
Simple pattern, powerful concept.
#LeetCode#Python#DSA
Day 153 of LeetCode π§
Graph revision day:
β’ Flood Fill
β’ Island Perimeter
β’ Find if Path Exists in Graph
Interesting takeaway:
Sometimes the state itself can replace a visited set.
#LeetCode#Python#DSA
Day 150 of LeetCode π§
542. 01 Matrix
Collect all 0s first β BFS outward.
Classic multi-source BFS pattern.
150 days of showing up π
#LeetCode#Python#DSA
Day 149 of LeetCode π§
Number of Islands
Rotting Oranges
Same BFS traversal pattern,
different problem twists.
Visited directions queue everywhere.
#LeetCode#Python#DSA