Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
Tags
- DP
- task cancel
- UIKit
- swift dashed line
- SWIFT
- custom navigation bar
- swift custom ui
- swift navigationcontroller
- coordinator
- swift concurrency
- swift bottomsheet
- Tuist
- rxdatasources
- swift 점선
- 버튼 피드백
- custom ui
- uikit toast
- BFS
- task cancellation
- button configuration
- reactorkit
- swift 백준
- custombottomsheet
- RxSwift
- paragraph style
- 타임라인 포맷팅
- claen architecture
- domain data
- identifiable
- traits
Archives
- Today
- Total
목록2025/04/14 (1)
김경록의 앱 개발 여정

풀이 아이디어그리디 알고리즘 문제입니다.조건을 떠올리면 바로 풀 수 있는 문제인데30의 배수라는 조건을 떠올려보면,일단 끝이 무조건 0입니다.또 각 자릿수의 합이 무조건 3의 배수입니다. 이 조건을 따른 자세한 풀이는 아래와 같습니다. 풀이let n = readLine()!let arr = n.map { Int(String($0))! }// 0을 가지고있고, 배열 총합이 3의 배수인지 확인합니다.if arr.contains(0) && arr.reduce(0, +) % 3 == 0 { //숫자를 뺄수있는 문제가 아니므로 그냥 무조건 정답입니다. //다른 순서대로 섞어도 결국 각자리 합이 3의 배수가 안나오면 30의 배수가 될 수 없음 let result = arr.sorted(by: >).map ..
Algorithm
2025. 4. 14. 19:05