Plan Round Trip With Minimum Flight Cost
Plan a round trip between 2 cities with minimum flight cost, given departure and return cost arrays.
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid July, 2026
Senior
Given a departure cost D = [.....] and Return cost R = [...] 1. Find the min cost of travel where Departure < Return 2. Return indices of departure and return. If tied return the earliest departure and latest return 3. Start with O(n^2) then optimize to O(n)
Mid April, 2026
Senior
Plan a round trip between two cities with minimum flight cost. Example: SFO -> Vegas -> SFO Inputs: Date: 0 1 2 3 4 From SFO -> Vegas, Airfare D[] = [10, 8, 9, 11, 7] From Vegas -> SFO, Airfare R[] = [8, 8, 10, 7, 9] Output: Fare = 8 + 7 = 15 Departure Day = 1, Return Day = 3,
Early March, 2026
Mid-level
Find the minimum cost of a round trip given two arrays ( departure and return) of equal size, where index represents time and value represents flight price. The key constraint is that the return flight must occur after the departure flight. Example: D = [10,8,9,11,7], R = [8,8,10,7,9] Answer: D[1] + R[3] = 15
Hello Interview Premium
Your account is free and you can post anonymously if you choose.