#3635
Earliest Finish Time for Land and Water Rides II
expert · 1075 · lc medium +32 · 35% accepted · 72 likes · top 13%
Description
Arrays landStartTime, landDuration, waterStartTime, and waterDuration describe theme-park rides. A tourist must complete exactly one land ride and one water ride in any order. A ride opened at time t with duration d finishes at t + d if boarding begins at t, or later if the tourist waits. The next ride is boarded immediately after finishing the first (or at its opening time, whichever is later). Return the earliest time at which both rides are finished.
Code
1
2
3