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 2be5ee9 commit f3b471cCopy full SHA for f3b471c
0001_two_sum/two_sum.cc
@@ -9,7 +9,7 @@ class Solution {
9
unordered_map<int, int> ht;
10
for (int i = 0; i < nums.size(); i++) {
11
int other = target - nums[i];
12
- if (ht.find(other) != ht.end()) {
+ if (ht.count(other)) {
13
/* Only one solution for purpose of this problem */
14
res.append(ht[other]);
15
res.append(i);
0001_two_sum/two_sum.py
0 commit comments