Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 572 Bytes

Question_3184.md

File metadata and controls

24 lines (20 loc) · 572 Bytes

LeetCode Records - Question 3184 Count Pairs That Form a Complete Day I

Attempt 1: Use a nested loop

class Solution {
    public int countCompleteDayPairs(int[] hours) {
        int count = 0;

        for (int i = 0; i < hours.length - 1; i++) {
            for (int j = i + 1; j < hours.length; j++) {
                if ((hours[i] + hours[j]) % 24 == 0) {
                    count++;
                }
            }
        }

        return count;
    }
}
  • Runtime: 1 ms (Beats: 98.16%)
  • Memory: 42.44 MB (Beats: 31.94%)