美文网首页
454. 4Sum II

454. 4Sum II

作者: 阿团相信梦想都能实现 | 来源:发表于2016-12-18 03:22 被阅读0次
class Solution(object):
    def fourSumCount(self, A, B, C, D):
        """
        :type A: List[int]
        :type B: List[int]
        :type C: List[int]
        :type D: List[int]
        :rtype: int
        """
        AB=collections.Counter(a+b for a in A for b in B)
        return sum(AB[-c-d] for c in C for d in D)

相关文章

网友评论

      本文标题:454. 4Sum II

      本文链接:https://www.haomeiwen.com/subject/mvpamttx.html