μΌ | μ | ν | μ | λͺ© | κΈ | ν |
---|---|---|---|---|---|---|
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 | 31 |
- Mac
- ExpressJS
- ios
- map
- mongoose
- Reduce
- String.Index
- νλ‘κ·Έλλ¨Έμ€
- Core Data
- Cloud Firestore
- Decodable
- μ§λ²λ³ν
- Figma
- μ±λ§λ€κΈ°
- Filter
- MongoDB
- RxSwift
- Encodable
- SWiFT
- nodejs
- Firestore CRUD
- μκ³ λ¦¬μ¦
- Codable
- AVAudioPlayer
- μ±λμμΈ
- CRUD
- components
- DispatchQueue
- Firestore
- UIRefreshController
- Today
- Total
Focus On Develop π€π€
[νλ‘κ·Έλλ¨Έμ€] κΈ°λ₯κ°λ° λ³Έλ¬Έ
<λ¬Έμ >
<μ λ΅μ§κΈ°>
λ¨Όμ κ° μμ μ΄ λͺμΌμ νμλ‘ νλμ§ μμμΌ νλ€. (100-progress) / speed λ₯Ό νλ©΄ λλλ°, μ΄κ² λ± λλμ΄ λ¨μ΄μ§μ§ μλ κ²½μ° νλ£¨κ° λ νμνλ€. μ΄λ κ² μμ μκ°μ΄ κ³μ°λ Queueλ₯Ό κ°μ§κ³ λ©μΈ λ‘μ§μ μμνλ€. μ μΌ λ¨Όμ λ°°ν¬λμ΄μΌ νλ μμ μ μμ μ΄ μλ£κ° λ λκΉμ§ μκ°μ νλ¬ λ³΄λΈλ€.(νμλ‘ νλ μμ μΌμμμ 1μ© λΉΌκΈ°) κ·Έλ¬λ€ μ°μ μμκ° κ°μ₯ λμ μμ μ΄ λ°°ν¬κ° κ°λ₯νκ² λλ©΄ κ·Έ λ€λ‘ λ°°ν¬κ° κ°λ₯ν μμ (νμλ‘ νλ μμ μΌμ <= 0 )μ λͺ¨λ λΉΌλ©΄μ λ°°ν¬λ³Έμλ₯Ό 1μ© λν΄μ£Όκ³ , λ°°ν¬ μ€λΉκ° μλ μμ μ΄ μ΅μ°μ μμ μμ μ΄ λλ©΄ κ³μ°νλ λ°°ν¬λ³Έμλ₯Ό κ²°κ³Ό λ°°μ΄μ λ£κ³ , λλ€μ μμ μΌμλ₯Ό νλ¬λ³΄λ΄λ (-1ν΄μ£Όλ) μμ μ λ°λ³΅νλ€.
<μ½λ>
import Foundation
func solution(_ progresses:[Int], _ speeds:[Int]) -> [Int] {
var workDay: [Int] = []
var res: [Int] = []
var cnt = 0
for i in 0...progresses.count-1 {
if (100 - progresses[i]) % speeds [i] == 0 {
workDay.append( (100 - progresses[i]) / speeds[i] )
} else {
workDay.append( (100 - progresses[i]) / speeds[i] + 1 )
}
}
while !workDay.isEmpty {
workDay = workDay.map { $0 - 1 }
while workDay.first! <= 0 {
workDay.removeFirst()
cnt += 1
if workDay.isEmpty {
break
}
}
if cnt != 0 {
res.append(cnt)
}
cnt = 0
}
return res
}
<Lesson Learned>
λ¬Έμ μμ μν€λ λλ‘ κ΅¬ννλ©΄(?) λλ λ¬Έμ κ°λ€. μ¬μ€ μλ while λ‘μ§μ μ’ κ°λ¨ν ν μ μλ λ°©λ²μ΄ μμ κ² κ°κΈ°λ νμ§λ§.. μλͺ¨λ₯΄κ² λ€ π π!
μΆμ : νλ‘κ·Έλλ¨Έμ€ κΈ°λ₯κ°λ°
'iOS [Swift] > μκ³ λ¦¬μ¦' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[νλ‘κ·Έλλ¨Έμ€] κ°μ₯ ν° μ (0) | 2020.12.29 |
---|---|
[νλ‘κ·Έλλ¨Έμ€] H-Index (0) | 2020.12.28 |
[νλ‘κ·Έλλ¨Έμ€] λ€λ¦¬λ₯Ό μ§λλ νΈλ (0) | 2020.12.27 |
[νλ‘κ·Έλλ¨Έμ€] ν° μ λ§λ€κΈ° (0) | 2020.12.23 |
[νλ‘κ·Έλλ¨Έμ€] μ€ν¬νΈλ¦¬ (0) | 2020.12.23 |