FastPrepFastPrep
Problem Brief

Update Release Scheduler (QR Intern)

INTERNOA

For a mobile software, there are a total of n planned updates. The scheduled release time for each update is provided in the array plannedDate, indicating the number until each update is planned to launch. There are earlier, alternate release dates for the updates, represented by the array alternateDate.

The software updates must be launched in the order of their planned release times. Each update can be launched either on the planned date or the alternate one. Determine the minimum number of days required to release all updates.

Note: Multiple updates can be released on the same day.

1Example 1

Input
n = 4, plannedDate = [3, 7, 4, 9], alternateDate = [1, 5, 2, 3]
Output
9
Explanation

The updates must be launched in the order of their planned release dates. Therefore, the order of release of updates is [1, 3, 2, 4]. The updates can be launched in the following order:

  • Update 1 on Day 1 (alternate release date)
  • Update 3 on Day 2 (alternate release date)
  • Update 2 on Day 5 (alternate release date)
  • Update 4 on Day 9 (planned date as the alternate date has passed)

This optimal sequence allows all updates to be released in 9 days.

Constraints

Limits and guarantees your solution can rely on.

๐ŸŽ๐ŸŽ
public int minimumDays(int n, int[] plannedDate, int[] alternateDate) {
  // write your code here
}
Input

n

4

plannedDate

[3, 7, 4, 9]

alternateDate

[1, 5, 2, 3]

Output

9

Sign in to submit your solution.