def route_from_tickets(tickets: list[list[str]]) -> list[str]:
The round: eight Pinterest reports, posted from December 2025 to September 2026, name this problem: four phone or technical screens and four onsite coding rounds, one of them in an MLE loop. Most name LeetCode 332, Reconstruct Itinerary, by number or title. The reported twists are about the start city: one onsite report says you must find the start yourself, and one phone screen says there is no fixed start and you take the start as an input. One onsite report says the first part had no loops, and the follow-up was how to handle a loop. Two graded parts.
Problem
You are given airline tickets, each a pair [from, to] of city names, in no particular order. Rebuild the trip that uses every ticket exactly once, as the list of cities in the order visited.
Part 1 — a simple route, no loops
def route_from_tickets(tickets: list[list[str]]) -> list[str]: ...
[["B", "C"], ["A", "B"]] -> ["A", "B", "C"].Follow-up reported (not graded): printing the path. The poster first describes it as printing the full route reached from the given start, for example JFK SFO DFW, then says they misremembered and that the follow-up should be printing all paths. Ask whether that means the one full route or every route from the start.
Notes: the problem, the find-the-start twist, the start passed as an input, the no-loop first part and the loop follow-up are reported. Ours: the function names, the examples, and accepting any valid trip. LeetCode 332 itself always starts at JFK and asks for the trip that is smallest in lexical order; no report says which tie-break your round uses, so ask. The reference returns the lexically smallest trip, so it also answers the LeetCode version.
Speed is not graded here: the editor cannot time your code. Say what your version costs.
Posted from December 2025 to September 2026 in phone screens, technical screens and onsite rounds, one in an MLE loop. One reply calls it very frequent. The reported differences from LeetCode 332 are about the start (find it yourself, or take it as an input), loops (a loop-free first part, then loops), and printing the path. One onsite report gives a first part with no loops and then asks how to handle a loop; that candidate did not solve the follow-up. One phone screen's follow-up was printing the path: the poster describes the full route reached, like JFK SFO DFW, then says it should be printing all paths. One reply asks whether the route is unique; no one answered, so ask about tie-breaks yourself.
What the reports say: LeetCode 332 with the start city as the twist: one report says you find the start yourself, one phone screen takes it as an input. One onsite report gives a first part with no loops and then asks how to handle a loop; that candidate did not solve it. One reply calls the question very frequent.
Common mistakes (ours): Taking the first ticket's departure as the start; A greedy walk that never backs up; A set of destinations that drops duplicate tickets; Deep recursion on a long trip
Edge cases to test (ours): A single ticket; A round trip with no start; The same pair on two tickets; A dead-end ticket that must be used last
Alternative approaches (ours): Backtracking DFS over sorted destinations (simpler to explain, exponential in the worst case); Recursive Hierholzer if the trip is short
Also reported as LeetCode 332
The round: eight Pinterest reports, posted from December 2025 to September 2026, name this problem: four phone or technical screens and four onsite coding rounds, one of them in an MLE loop. Most name LeetCode 332, Reconstruct Itinerary, by number or title. The reported twists are about the start city: one onsite report says you must find the start yourself, and one phone screen says there is no fixed start and you take the start as an input. One onsite report says the first part had no loops, and the follow-up was how to handle a loop. Two graded parts.
Problem
You are given airline tickets, each a pair [from, to] of city names, in no particular order. Rebuild the trip that uses every ticket exactly once, as the list of cities in the order visited.
Part 1 — a simple route, no loops
def route_from_tickets(tickets: list[list[str]]) -> list[str]: ...
[["B", "C"], ["A", "B"]] -> ["A", "B", "C"].Part 2 — the route can loop back
def reconstruct_itinerary(tickets: list[list[str]], start: str | None = None) -> list[str]: ...
[from, to] pair can appear on more than one ticket. Use every ticket exactly once. A valid trip always exists.start is given, the trip begins there. If not, find a valid start yourself.[["JFK", "KUL"], ["JFK", "NRT"], ["NRT", "JFK"]] with start="JFK" -> ["JFK", "NRT", "JFK", "KUL"]. Going to KUL first leaves you stuck with two tickets unused.Follow-up reported (not graded): printing the path. The poster first describes it as printing the full route reached from the given start, for example JFK SFO DFW, then says they misremembered and that the follow-up should be printing all paths. Ask whether that means the one full route or every route from the start.
Notes: the problem, the find-the-start twist, the start passed as an input, the no-loop first part and the loop follow-up are reported. Ours: the function names, the examples, and accepting any valid trip. LeetCode 332 itself always starts at JFK and asks for the trip that is smallest in lexical order; no report says which tie-break your round uses, so ask. The reference returns the lexically smallest trip, so it also answers the LeetCode version.
Speed is not graded here: the editor cannot time your code. Say what your version costs.
How do you handle a loop, where the trip comes back through a city?
Print the path: the poster describes the full route reached from the given start (for example JFK SFO DFW), then says it should be printing all paths. Ask which one is meant.
What the reports say: LeetCode 332 with the start city as the twist: one report says you find the start yourself, one phone screen takes it as an input. One onsite report gives a first part with no loops and then asks how to handle a loop; that candidate did not solve it. One reply calls the question very frequent.
Common mistakes (ours): Taking the first ticket's departure as the start; A greedy walk that never backs up; A set of destinations that drops duplicate tickets; Deep recursion on a long trip
Edge cases to test (ours): A single ticket; A round trip with no start; The same pair on two tickets; A dead-end ticket that must be used last
Alternative approaches (ours): Backtracking DFS over sorted destinations (simpler to explain, exponential in the worst case); Recursive Hierholzer if the trip is short
If you have had this round, tell us how close this page was. It is how we keep the pages accurate.
Send them this page. It is free to read, no account needed.
What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 70 Pinterest questions, refreshed monthly from new candidate reports.