import Foundation
func solution(_ numbers:[Int]) -> [Int] {
var set = Set<Int>()
for i in 0..<numbers.count {
for j in i+1..<numbers.count{
set.insert(numbers[i] + numbers[j])
}
}
return Array(set).sorted()
}
'프로그래머스 > Lv.1' 카테고리의 다른 글
[Swift] 둘만의 암호 (0) | 2023.02.12 |
---|---|
[Swift] 두 정수 사이의 합 (0) | 2023.02.12 |
[Swift] 내적 (0) | 2023.02.12 |
[Swift] 나머지가 1이 되는 수 찾기 (0) | 2023.02.12 |
[Swift] 나누어 떨어지는 숫자 배열 (0) | 2023.02.12 |