1983. Widest Pair of Indices With Equal Range Sum
Содержание
class Solution:
def widestPairOfIndices(self, nums1: List[int], nums2: List[int]) -> int:
d = {0: -1}
res = s = 0
for i, (a, b) in enumerate(zip(nums1, nums2)):
s += a - b
if s in d:
res = max(res, i - d[s])
else:
d[s] = i
return res