Skip to content

Commit d757cbe

Browse files
committed
Fixes a typo.
1 parent 9f1f467 commit d757cbe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Two-Sum Problem/README.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ This solution uses a dictionary to store differences between each element in the
1111
With this approach, each key in the dictionary corresponds to a new target value. If one of the successive numbers from the array is equal to one of the dictionary's keys, then we know there exist two numbers that sum.
1212

1313
```swift
14-
func twoSumProblem(_ numbers: [Int], sum: Int) -> (Int, Int)? {
14+
func twoSumProblem(_ numbers: [Int], target: Int) -> (Int, Int)? {
1515
var dict: [Int: Int] = [:]
1616

1717
for (index, number) in numbers.enumerated() {
1818
if let otherIndex = dict[number] {
1919
return (index, otherIndex)
2020
} else {
21-
dict[sum - number] = index
21+
dict[target - number] = index
2222
}
2323
}
2424

0 commit comments

Comments
 (0)