Skip to main content
📜 WAYPOINT LESSON

Constrained Lattice Paths

⭐⭐⭐ advanced⏳ 30 min read📍 Lesson 175 of 281

Total paths minus paths through the obstacle: a two-binomial product that the reflection identity makes O(1).

Subtracting the bad routes

Paths on an n×m grid from corner to corner: C(n+m, n). With ONE forbidden cell: total - paths((0,0)→cell) × paths(cell→goal). Each factor is a single binomial. Multiple obstacles need inclusion-exclusion over subsets — the previous lesson generalizes.

⚡ Now practice

Ready to Code
Counting SuiteCatalans at n = 5e5, four-divisor inclusion-exclusion at N = 1e12, and lattice paths around a forbidden cell.
3 challenges · · ~110 min