Skip to content

Commit 784437b

Browse files
Merge pull request #2907 from zenwangzy/master
Update 0454.四数相加II,力扣函数参数更新,故更新对应题解代码
2 parents a6caded + d6e6804 commit 784437b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

problems/0454.四数相加II.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ C++代码:
6060
```CPP
6161
class Solution {
6262
public:
63-
int fourSumCount(vector<int>& A, vector<int>& B, vector<int>& C, vector<int>& D) {
63+
int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {
6464
unordered_map<int, int> umap; //key:a+b的数值,value:a+b数值出现的次数
6565
// 遍历大A和大B数组,统计两个数组元素之和,和出现的次数,放到map中
66-
for (int a : A) {
67-
for (int b : B) {
66+
for (int a : nums1) {
67+
for (int b : nums2) {
6868
umap[a + b]++;
6969
}
7070
}
7171
int count = 0; // 统计a+b+c+d = 0 出现的次数
7272
// 再遍历大C和大D数组,找到如果 0-(c+d) 在map中出现过的话,就把map中key对应的value也就是出现次数统计出来。
73-
for (int c : C) {
74-
for (int d : D) {
73+
for (int c : nums3) {
74+
for (int d : nums4) {
7575
if (umap.find(0 - (c + d)) != umap.end()) {
7676
count += umap[0 - (c + d)];
7777
}

0 commit comments

Comments
 (0)