FastPrepFlights 🚁

Flights 🚁

The Trade Desk logoThe Trade Desk● EasyOA
Learn

Problem statement

In the tale of two interconnected destinations served by flights, travelers aim to complete round trips between them. Flights in one direction take 100 minutes, and return flights take the same duration. Their goal is to determine the moment they'll finish their final round trip, assuming they always board the earliest available flight.

To aid in their journey, the function "tDeskFlights" requires three inputs: two arrays of departure times (one for outbound flights and one for return flights) and the number of round trips planned. It then returns the time in minutes when the last round trip concludes.

For original prompt, pls refer to source image ౨ৎ

Function

tDeskFlights(c2d: int[], d2c: int[], journies: int) β†’ int

Examples

Example 1

c2d = [0, 200, 500]d2c = [99, 210, 450]journies = 1return = 310

Your journey begins as you depart from C to D at minute 0, arriving at D at 100. Shortly after, you return from D to C on the earliest available flight, departing D at 210. Thus, you reach C at 310, marking the conclusion of your journey.

Constraints

  • Unknown for now

More The Trade Desk problems

See The Trade Desk hiring insights
public int tDeskFlights(int[] c2d, int[] d2c, int journies) {
    // write your code here
}
c2d[0, 200, 500]
d2c[99, 210, 450]
journies1
expected310
Checking account…