Google-Developer-Student-Club-CCOEW / Competitive-Programming-2023-GDSC-CUMMINS-X-GDSC-MMCOE

Welcome to the Hacktoberfest 2023 Competitive-Programming Cohort for Cummins College and MMCOE students! To request issue assignment, create a pull request, providing: 1. Full Name šŸ§‘ā€šŸŽ“ 2.Email šŸ“§ 3.College ID (RNO) šŸ”¢ 4.Branch of Study.šŸ“š 5. Year šŸ“† .The Cummins College and MMCOE students' PRs will be considered only. Thank you!
9 stars 69 forks source link

Reconstruct Itinerary #93

Closed saakshii12 closed 11 months ago

saakshii12 commented 1 year ago

Write code in the preferred language and attach output with it.

You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.

All of the tickets belong to a man who departs from "JFK", thus, the itinerary must begin with "JFK". If there are multiple valid itineraries, you should return the itinerary that has the smallest lexical order when read as a single string.

For example, the itinerary ["JFK", "LGA"] has a smaller lexical order than ["JFK", "LGB"]. You may assume all tickets form at least one valid itinerary. You must use all the tickets once and only once.

Example 1: image Input: tickets = [["MUC","LHR"],["JFK","MUC"],["SFO","SJC"],["LHR","SFO"]] Output: ["JFK","MUC","LHR","SFO","SJC"]

Example 2: image Input: tickets = [["JFK","SFO"],["JFK","ATL"],["SFO","ATL"],["ATL","JFK"],["ATL","SFO"]] Output: ["JFK","ATL","JFK","SFO","ATL","SFO"] Explanation: Another possible reconstruction is ["JFK","SFO","ATL","JFK","ATL","SFO"] but it is larger in lexical order.

Eesha04 commented 11 months ago

Name- Eesha Satvalekar email - eesha.satvalekar@cumminscollege.in Can you please assign this issue to me?