Question
You have a list of one-way flight tickets [from, to] (airport codes). Reconstruct an itinerary that uses every ticket exactly once and starts at 'JFK'. It is guaranteed at least one valid itinerary exists. If multiple are possible, return the one that is lexicographically smallest when read as a list of airport codes. Return the itinerary as a list of airport codes in visiting order.
reconstruct_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.