프로그래머스 문제입니다.
https://programmers.co.kr/learn/courses/30/lessons/68644
import Foundation
func solution(_ numbers:[Int]) -> [Int] {
var set: Set<Int> = []
for (i,num1) in numbers.enumerated() {
for (j,num2) in numbers.enumerated() {
if i != j {
set.insert(num1+num2)
}
}
}
let result = Array(set).sorted(by: <)
return result
}
https://stackoverflow.com/questions/29046695/swift-set-to-array
https://jinhongstar.tistory.com/91