Find Itinerary from a given list of tickets.
Given a list of tickets, find itinerary in order using the given list.
“Chennai” -> “Banglore”
“Bombay” -> “Delhi”
“Goa” -> “Chennai”
“Delhi” -> “Goa”
Bombay->Delhi, Delhi->Goa, Goa->Chennai, Chennai->Banglore,
It may be assumed that the input list of tickets is not cyclic and there is one ticket from every city except final destination.
– One solution is Topological Sorting
– Another is iteration over hash map (hint reverse of map to get starting point)
Latest Source Code:
Bombay -> Delhi -> Goa -> Chennai -> Banglore