Cheapest Flights Within K Stops
Given n cities and flights [from, to, price] Find the cheapest price from src to dst with at most k stops Return -1 if no such route exists Example: n=3, flights=[[0,1,100],[1,2,100],[0,2,500]], src=0, dst=2, k=1 => 200
Cheapest Flights Within K Stops is about turning repeated work into a reusable state instead of re-solving subproblems. Interviewers love it because it reveals your state-and-transition thinking and your edge-case discipline. Once you define the right state, the transitions usually write themselves.

Meet Coco
Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit, and to talk with her for one hour. After that, talking comes with the $79 pack. Anyone can open the editor and run their code.