Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Complete All Deliveries

med
30 min
Try to solve the Minimum Time to Complete All Deliveries problem.

Statement

You are given two integer arrays of length 22, d = [d_1, d_2] and r = [r_1, r_2].

There are two delivery drones:

  • The first drone must complete d[0] deliveries and must recharge at every hour that is a multiple of r[0].

  • The second drone must complete d[1] deliveries and must recharge at every hour that is a multiple of r[1].

At any given hour tt (starting from hour 11):

  • A drone cannot make a delivery during an hour it is recharging.

  • At most one drone can make a delivery during that hour.

Return the minimum number of hours required for both drones to complete all deliveries.

Constraints:

  • d.length =2= 2

  • r.length =2= 2

  • 1≤1 \le d[i] ≤109\le 10^9

  • 2≤2 \le r[i] ≤3imes104\le 3 imes 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Complete All Deliveries

med
30 min
Try to solve the Minimum Time to Complete All Deliveries problem.

Statement

You are given two integer arrays of length 22, d = [d_1, d_2] and r = [r_1, r_2].

There are two delivery drones:

  • The first drone must complete d[0] deliveries and must recharge at every hour that is a multiple of r[0].

  • The second drone must complete d[1] deliveries and must recharge at every hour that is a multiple of r[1].

At any given hour tt (starting from hour 11):

  • A drone cannot make a delivery during an hour it is recharging.

  • At most one drone can make a delivery during that hour.

Return the minimum number of hours required for both drones to complete all deliveries.

Constraints:

  • d.length =2= 2

  • r.length =2= 2

  • 1≤1 \le d[i] ≤109\le 10^9

  • 2≤2 \le r[i] ≤3imes104\le 3 imes 10^4