-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path기능개발.swift
More file actions
36 lines (30 loc) · 756 Bytes
/
기능개발.swift
File metadata and controls
36 lines (30 loc) · 756 Bytes
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
32
33
34
35
36
//
// 기능개발.swift
//
//
// Created by chihoooon on 2022/01/21.
//
import Foundation
func solution(_ progresses:[Int], _ speeds:[Int]) -> [Int] {
var answer: [Int] = []
var deployment: [Int] = []
for i in 0..<progresses.count {
let remain = Double(100 - progresses[i])
let speed = Double(speeds[i])
deployment.append(Int(ceil(remain / speed)))
}
var date = deployment[0]
var deploy = 1
for i in 1..<deployment.count {
if date >= deployment[i] {
deploy += 1
}
else {
answer.append(deploy)
date = deployment[i]
deploy = 1
}
}
answer.append(deploy)
return answer
}