Question
You are given a list of airline tickets [from, to]. All tickets belong to a person who departs from 'JFK', and you must reconstruct the itinerary that uses every ticket exactly once. If multiple valid itineraries exist, return the one with the smallest lexical order when read as a single concatenated list of airport codes. A valid itinerary using all tickets is guaranteed to exist. Return the ordered list of airports visited.
find_itinerary(tickets: list[list[str]]) → list[str][[["MUC","LHR"],["JFK","MUC"],["SFO","SJC"],["LHR","SFO"]]]out["JFK","MUC","LHR","SFO","SJC"]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.