leetcode1010】的更多相关文章

In a list of songs, the i-th song has a duration of time[i] seconds. Return the number of pairs of songs for which their total duration in seconds is divisible by 60.  Formally, we want the number of indices i < j with (time[i] + time[j]) % 60 == 0.…
class Solution: def numPairsDivisibleBy60(self, time: 'List[int]') -> int: sums = 0 s = {} n = len(time) if n>=20: targets = [] for i in range(1,19): targets.append(60*i) for i in range(len(time)): cur = time[i] for tar in targets: cop = tar - cur i…