查找表_leetcode454

# 解题思路:字典存储计数信息 20190302 找工作期间

class Solution(object):
def fourSumCount(self, A, B, C, D):
res2 = {}
res = 0

for i in C:
for j in D:
res2[i + j] = res2.get(i + j, 0) + 1

for i in A:
for j in B:
res += res2.get(-i - j, 0)

return res

原文地址:https://www.cnblogs.com/lux-ace/p/10546971.html