Skip to content

Commit 5e96c29

Browse files
authored
Update two-sum-iii-data-structure-design.cpp
1 parent 86115a9 commit 5e96c29

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

C++/two-sum-iii-data-structure-design.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ class TwoSum {
55
public:
66

77
// Add the number to an internal data structure.
8-
void add(int number) {
9-
++lookup_[number];
10-
}
8+
void add(int number) {
9+
++lookup_[number];
10+
}
1111

1212
// Find if there exists any pair of numbers which sum is equal to the value.
13-
bool find(int value) {
14-
for (const auto& kvp : lookup_) {
15-
const auto num = value - kvp.first;
16-
if (lookup_.count(num) && (num != kvp.first || kvp.second > 1)) {
17-
return true;
18-
}
19-
}
20-
return false;
21-
}
13+
bool find(int value) {
14+
for (const auto& kvp : lookup_) {
15+
const auto num = value - kvp.first;
16+
if (lookup_.count(num) && (num != kvp.first || kvp.second > 1)) {
17+
return true;
18+
}
19+
}
20+
return false;
21+
}
2222

2323
private:
2424
unordered_map<int, int> lookup_;

0 commit comments

Comments
 (0)