Given an array of tickets
tickets, where tickets[i] = [from, to] is a flight from from to to. Reconstruct an itinerary that uses every ticket exactly once, starting from "JFK". If there are multiple solutions, return the lexicographically smallest one.Example 1
Input: tickets = [["JFK","B"],["JFK","A"],["B","JFK"]]
Output: ["JFK","B","JFK","A"]
Explanation: Lexicographically smallest route.
Output: ["JFK","B","JFK","A"]
Explanation: Lexicographically smallest route.
Example 2
Input: tickets = [["MUC","LHR"],["JFK","MUC"],["SFO","SJC"],["LHR","SFO"]]
Output: ["JFK","MUC","LHR","SFO","SJC"]
Explanation: Classic route example.
Output: ["JFK","MUC","LHR","SFO","SJC"]
Explanation: Classic route example.