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 ffaa6d8 commit 0d7e8daCopy full SHA for 0d7e8da
two-sum/delight010.swift
@@ -2,6 +2,7 @@ class Solution {
2
func twoSum(_ nums: [Int], _ target: Int) -> [Int] {
3
var dictionary: [Int: Int] = [:]
4
for (index, value) in nums.enumerated() {
5
+ // nums배열의 개수만큼 반복합니다. O(n)
6
let difference = target - value
7
if let otherIndex = dictionary[difference] {
8
return [otherIndex, index]
0 commit comments