Skip to main content

Practice · 1 of 3

The Cycle in Disguise

CHALLENGE
Difficulty: advanced+25 XP

**Scenario.** States are (position, fuel remaining); moves consume fuel; refueling stations reset it. You must count distinct states reachable from the start. What graph do you build? **Which approach is the best fit? The program only needs to print the letter.** **A)** A DAG — fuel always decreases along moves **B)** A general directed graph; fuel resets at stations create cycles, so SCC contraction or BFS over states is required **C)** A tree of states — every state has a unique parent **D)** No graph; sort the stations and binary search

Back to lesson: Practice: Graph Synthesis Drills