Skip to content

Latest commit

 

History

History

count-pairs-that-form-a-complete-day-i

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Count pairs that form a complete day i

Problem link

Solutions

Solution.py

# https://leetcode.com/problems/count-pairs-that-form-a-complete-day-i/

class Solution:
    def countCompleteDayPairs(self, hours: List[int]) -> int:
        cnt = defaultdict(int)
        ret = 0
        for x in hours:
            ret += cnt[(24 - x % 24) % 24]
            cnt[x % 24] += 1
        return ret

Tags