STUDYING/Algorithm
[Programmers] 두 개 뽑아서 더하기
EOZIN
2021. 9. 27. 00:41
728x90
https://programmers.co.kr/learn/courses/30/lessons/68644
import Foundation
func solution(_ numbers: [Int]) -> [Int] {
var plusSet = Set<Int>()
for i in 0..<numbers.count {
for j in i + 1..<numbers.count {
plusSet.insert(numbers[i] + numbers[j])
}
}
return plusSet.sorted()
}