medium 0 views

Earliest Finish Time for Land and Water Rides II

You are given two categories of theme park attractions: land rides and water rides.

You are given two categories of theme park attractions: land rides and water rides.

A tourist must experience exactly one ride from each category, in either order.

Return the earliest possible time at which the tourist can finish both rides.

Example 1

Input: landStartTime = [2,8], landDuration = [4,1], waterStartTime = [6], waterDuration = [3]

Output: 9

Explanation: ​​​​​​​ Plan A gives the earliest finish time of 9.

Example 2

Input: landStartTime = [5], landDuration = [3], waterStartTime = [1], waterDuration = [10]

Output: 14

Explanation: ​​​​​​​ Plan A provides the earliest finish time of 14. ​​​​​​​

Constraints

  • 1 <= n, m <= 5 * 10^4
  • landStartTime.length == landDuration.length == n
  • waterStartTime.length == waterDuration.length == m
  • 1 <= landStartTime[i], landDuration[i], waterStartTime[j], waterDuration[j] <= 10^5

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.