import Foundation
func solution(_ absolutes:[Int], _ signs:[Bool]) -> Int {
return (0..<absolutes.count).map { signs[$0] ? absolutes[$0] : -absolutes[$0] }.reduce(0, +)
}
'프로그래머스 > Lv.1' 카테고리의 다른 글
[Swift] 자릿수 더하기 (0) | 2023.02.15 |
---|---|
[Swift] 이상한 문자 만들기 (0) | 2023.02.15 |
[Swift] 옹알이 (2) (0) | 2023.02.15 |
[Swift] 예산 (0) | 2023.02.15 |
[Swift] 없는 숫자 더하기 (0) | 2023.02.15 |