3185. Count Pairs That Form a Complete Day II Medium

@problem@discussion
#Array#Hash Table#Counting



1/**
2 * [3185] Count Pairs That Form a Complete Day II
3 *
4 * Given an integer array hours representing times in hours, return an integer denoting the number of pairs i, j where i < j and hours[i] + hours[j] forms a complete day.
5 * A complete day is defined as a time duration that is an exact multiple of 24 hours.
6 * For example, 1 day is 24 hours, 2 days is 48 hours, 3 days is 72 hours, and so on.
7 *  
8 * <strong class="example">Example 1:
9 * <div class="example-block">
10 * Input: <span class="example-io">hours = [12,12,30,24,24]</span>
11 * Output: <span class="example-io">2</span>
12 * Explanation: The pairs of indices that form a complete day are (0, 1) and (3, 4).
13 * </div>
14 * <strong class="example">Example 2:
15 * <div class="example-block">
16 * Input: <span class="example-io">hours = [72,48,24,3]</span>
17 * Output: <span class="example-io">3</span>
18 * Explanation: The pairs of indices that form a complete day are (0, 1), (0, 2), and (1, 2).
19 * </div>
20 *  
21 * Constraints:
22 * 
23 * 	1 <= hours.length <= 5 * 10^5
24 * 	1 <= hours[i] <= 10^9
25 * 
26 */
27pub struct Solution {}
28
29// problem: https://leetcode.com/problems/count-pairs-that-form-a-complete-day-ii/
30// discuss: https://leetcode.com/problems/count-pairs-that-form-a-complete-day-ii/discuss/?currentPage=1&orderBy=most_votes&query=
31
32// submission codes start here
33
34impl Solution {
35    pub fn count_complete_day_pairs(hours: Vec<i32>) -> i64 {
36        
37    }
38}
39
40// submission codes end
41
42#[cfg(test)]
43mod tests {
44    use super::*;
45
46    #[test]
47    fn test_3185() {
48    }
49}
50


Back
© 2025 bowen.ge All Rights Reserved.