Algorithm · Meta · Hard
You receive a two-dimensional integer array flights. Each entry flights[i] is [source, destination, price], describing a one-way flight from source to destination that costs price. Starting in city A, determine the least total price of a round-trip ticket. A valid trip must leave city A and eventually return to city A. At least one such round trip is guaranteed to exist. Example Input: 5 Output: Explanation: The lowest-cost round trip is 0 -> 1 -> 3 -> 0, with total cost 45…
Checking your access…