When I change the input to [["JFK","KUL"],["JFK","NRT"],["NRT","JFR"]], the "expected answer" becomes like this.
That's stupid. It should be a bug here.
i think leetcode is making a mistake here. Just check this link, http://i.imgur.com/AeeiIuz.png, the "Expected Answer" is clearly wrong here.
It is not a valid input.
There is no Eulerian Path in your graph.
But I think the problem statement made you confused.
What it wants to say is that all the tickets are from the man's travel. And you have all of them. So there must be a Eulerian Path in the graph. At least the man's actually itineray is a Eulerian Path.
Please continue under such assumption.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.