LeetCode solutions

3421. Count Pairs That Form a Complete Day I

My accepted Python solution to LeetCode problem 3421, Count Pairs That Form a Complete Day I, running in 11ms.

  • Difficulty: Easy
  • Python
  • Runtime 11ms
  • Memory 17.3MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 11ms, memory 17.3MB, accepted 2025-12-30.

python
class Solution:
    def countCompleteDayPairs(self, hours: List[int]) -> int:
        count = 0
        n = len(hours)
        for i in range(n):
            for j in range(i + 1, n):
                if (hours[i] + hours[j]) % 24 == 0:
                    count += 1
        return count

Source