Algorithm · Meta · Easy
Problem Two arrays contain flight prices indexed by time. FROM[i] is the cost of departing at time i, while TO[i] is the price of returning at that time. Choose one departure and one return flight so that the return occurs strictly later than the departure. In other words, after departing at index i, the return index must be at least i + 1. Find the lowest possible total price for the round trip in O(n) time. Implement: Constraints FROM and TO have the same length. Every…
Checking your access…