func solution(_ citations:[Int]) -> Int {
let sortedCitaions = citations.sorted(by: >)
var result = 0
for i in 0..<sortedCitaions.count {
if i < sortedCitaions[i] {
result += 1
}
}
return result
}'Algorithm > 프로그래머스' 카테고리의 다른 글
| Level2 - 타겟넘버(Swift) (0) | 2022.08.09 |
|---|---|
| Level2 - 가장 큰 수(Swift) (0) | 2022.08.09 |
| Level1 - 신규 아이디 추천(Swift) (0) | 2022.08.07 |
| Level1 - 로또의 최고 순위와 최저 순위(Swift) (0) | 2022.07.31 |
| Level1 - 신고 결과 받기(Swift) (0) | 2022.07.24 |