1010. Pairs of Songs With Total Durations Divisible by 60
class Solution:
def numPairsDivisibleBy60(self, time: List[int]) -> int:
table = defaultdict(int)
ans = 0
for t in time:
a = t % 60
if a == 0:
target = 0
ans += table[0]
else:
target = 60 - a
ans += table[target]
table[a] += 1
return ansLast updated