class Solution {
public:
int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {
int ans = 0;
unordered_map<int, int> unmap;
for(int elem1 : nums1){
for(int elem2 : nums2){
++unmap[elem1 + elem2];
}
}
for(int elem3 : nums3){
for(int elem4 : nums4){
if(unmap.find(-(elem3 + elem4)) != unmap.end()){
ans += unmap[-(elem3 + elem4)];
}
}
}
return ans;
}
};
标签:四数,unmap,int,elem4,454,elem3,II,vector,ans From: https://www.cnblogs.com/llllmz/p/18452274