Publicis Sapient Hiring Experience 2023 | Advanced Graph Traversal, Eulerian Path Construction, DFS Backtracking, and Lexicographical Ordering Challenge
Publicis-Sapient · Question · Posted Jun 2026
Problem Statement You are given a list of airline tickets represented as pairs [from, to]. Your task is to reconstruct the itinerary in order. The itinerary must: Start from "JFK". Use all tickets exactly once. Return the lexicographically smallest itinerary if multiple valid itineraries exist. Return the reconstructed itinerary. Example 1 Input tickets = [ ["MUC","LHR"], ["JFK","MUC"], ["SFO","SJC"], ["LHR","SFO"] ] Output ["JFK","MUC","LHR","SFO","SJC"] Explanation The only valid route that uses every ticket exactly ...
The full answer & interview discussion are available to premium members.
Log in Create a free account