[Swift 알고리즘] - 음양 더하기 (Programmers)
https://school.programmers.co.kr/learn/courses/30/lessons/76501 문제 사진 내 풀이 import Foundation func solution(_ absolutes:[Int], _ signs:[Bool]) -> Int { var result: [Int] = [] for (idx, el) in signs.enumerated() { el == true ? result.append(absolutes[idx]) : result.append(-absolutes[idx]) } return result.reduce(0, { $0 + $1 }) } solution([4, 7, 12], [true, false, true]) signs에서 false가 있는 index만 ab..
알고리즘
2022. 10. 20. 09:18
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- swift property
- Swift inout
- swift (programmers)
- Swift init
- 원티드 프리온보딩
- Swift final
- ios
- CS 네트워크
- Class
- Swift 프로그래머스
- iOS error
- Swift 알고리즘
- Swift Leetcode
- swift 고차함수
- 2023년 회고
- removeLast()
- swift protocol
- Swift RIBs
- Swift joined
- swift reduce
- Combine: Asynchronous Programming with Swift
- swift programmers
- Swift 내림차순
- Swift Error Handling
- Swift 프로퍼티
- Swift ModernRIBs
- RIBs tutorial
- Swift joined()
- Swift
- RTCCameraVideoCapturer
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함