Get Minimum Round Trip Cost (for E4)
Problem Overview
- Find the minimum round-trip flight cost given two arrays: departing[i] and returning[j], with the constraint j > i.
- Input: costs by time index for depart and return; Output: smallest possible sum; required time complexity O(n).
- Real-world context: choosing the cheapest outbound and return flights where return occurs after departure.
- This Meta interviews coding interview problem is a common interview question focused on cost optimization.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
