Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7111b2 commit 6cd8babCopy full SHA for 6cd8bab
C++/chapLinearList.tex
@@ -455,7 +455,7 @@ \subsubsection{代码}
455
}
456
for (int i = 0; i < num.size(); i++) {
457
const int gap = target - num[i];
458
- if (mapping.find(gap) != mapping.end()) {
+ if (mapping.find(gap) != mapping.end() && mapping[gap] > i) {
459
result.push_back(i + 1);
460
result.push_back(mapping[gap] + 1);
461
break;
0 commit comments