Golang | Leetcode Golang题解之第454题四数相加II
题目:
题解:
func fourSumCount(a, b, c, d []int) (ans int) {countAB := map[int]int{}for _, v := range a {for _, w := range b {countAB[v+w]++}}for _, v := range c {for _, w := range d {ans += countAB[-v-w]}}return
}