[Swift 알고리즘]H-Index

https://programmers.co.kr/learn/courses/30/lessons/42747

import Foundation

func solution(_ citations:[Int]) -> Int {
    
    let array = citations.sorted(by: >)

    
    for (index, value) in array.enumerated() {
        
        if index + 1 > value {
            return index
        }
    }
    
    return citations.count
}

좋은 웹페이지 즐겨찾기