3733. Minimum Time to Complete All Deliveries Medium
1/**
2 * [3733] Minimum Time to Complete All Deliveries
3 *
4 * You are given two integer arrays of size 2: d = [d1, d2] and r = [r1, r2].
5 * Two delivery drones are tasked with completing a specific number of deliveries. Drone i must complete di deliveries.
6 * Each delivery takes exactly one hour and only one drone can make a delivery at any given hour.
7 * Additionally, both drones require recharging at specific intervals during which they cannot make deliveries. Drone i must recharge every ri hours (i.e. at hours that are multiples of ri).
8 * Return an integer denoting the minimum total time (in hours) required to complete all deliveries.
9 *
10 * <strong class="example">Example 1:
11 * <div class="example-block">
12 * Input: <span class="example-io">d = [3,1], r = [2,3]</span>
13 * Output: <span class="example-io">5</span>
14 * Explanation:
15 *
16 * The first drone delivers at hours 1, 3, 5 (recharges at hours 2, 4).
17 * The second drone delivers at hour 2 (recharges at hour 3).
18 * </div>
19 * <strong class="example">Example 2:
20 * <div class="example-block">
21 * Input: <span class="example-io">d = [1,3], r = [2,2]</span>
22 * Output: <span class="example-io">7</span>
23 * Explanation:
24 *
25 * The first drone delivers at hour 3 (recharges at hours 2, 4, 6).
26 * The second drone delivers at hours 1, 5, 7 (recharges at hours 2, 4, 6).
27 * </div>
28 * <strong class="example">Example 3:
29 * <div class="example-block">
30 * Input: <span class="example-io">d = [2,1], r = [3,4]</span>
31 * Output: <span class="example-io">3</span>
32 * Explanation:
33 *
34 * The first drone delivers at hours 1, 2 (recharges at hour 3).
35 * The second drone delivers at hour 3.
36 * </div>
37 *
38 * Constraints:
39 *
40 * d = [d1, d2]
41 * 1 <= di <= 10^9
42 * r = [r1, r2]
43 * 2 <= ri <= 3 * 10^4
44 *
45 */
46pub struct Solution {}
47
48// problem: https://leetcode.com/problems/minimum-time-to-complete-all-deliveries/
49// discuss: https://leetcode.com/problems/minimum-time-to-complete-all-deliveries/discuss/?currentPage=1&orderBy=most_votes&query=
50
51// submission codes start here
52
53impl Solution {
54 pub fn minimum_time(d: Vec<i32>, r: Vec<i32>) -> i64 {
55
56 }
57}
58
59// submission codes end
60
61#[cfg(test)]
62mod tests {
63 use super::*;
64
65 #[test]
66 fn test_3733() {
67 }
68}
69Back
© 2026 bowen.ge All Rights Reserved.