def fourSumCount(self, A, B, C, D): 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)
@slcott You're using the same library I'm using.
last edited by
@StefanPochmann Brilliant man! Beautiful and elegant solution. Power of python.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.