Skip to main content
hardNeetCode 150

Reconstruct Itinerary

Given tickets array where each [from, to] is a flight Start from "JFK" and return itinerary in lexical order Example: [["MUC","LHR"],["JFK","MUC"],["SFO","SJC"],["LHR","SFO"]] => ["JFK","MUC","LHR","SFO","SJC"]

Reconstruct Itinerary rewards structured search and good pruning more than raw cleverness. It's a hard one for a reason: it stresses structured exploration when the rules pile up. The gotcha is duplicates and dead ends—good pruning and ordering rules make this manageable.

BacktrackingBFS / DFSGraphs

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. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1Reconstruct Flight Itineraryhard
Based onLeetCode