Find the lexicographically smallest valid flight itinerary from a list of tickets.
Constraints
Example
>>> reconstruct_itinerary([["JFK","SFO"],["JFK","ATL"],["SFO","ATL"],["ATL","JFK"],["ATL","SFO"]]) ['JFK', 'ATL', 'JFK', 'SFO', 'ATL', 'SFO'] >>> reconstruct_itinerary([["JFK","KUL"],["JFK","NRT"],["NRT","JFK"]]) ['JFK', 'NRT', 'JFK', 'KUL']
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints