← Queue / BFS

Pattern Recognition Drill

#46 — Snakes and ladders (BFS)

Medium Graphs

The Problem

Find minimum dice rolls to reach square 100 on a snakes-and-ladders board.

What approach would you use?

Think about it before scrolling down.

Key Signals

Queue / BFS

Model board as graph. BFS from square 1. Each node has edges to squares +1 through +6 (with redirects). O(n).

Common Trap

This IS a graph problem in disguise. The key insight is modeling the board as a graph.

← #45 #47 →