해맑은욱 2019. 9. 5. 16:51
*H-Index(정렬) 
논문 n편 중, h번 이상 인용된 논문이 h편 이상 나머지 논문이 h번 이하 인용되었다면 h = H-Index. 
 
 
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std
 
int solution(vector citations) { 
    int answer = 0
 
    sort(citations.begin(), citations.end(), greater<int>()); 
 
    int p = 0;     
    while(true
    { 
        if(p >= citations[p]) 
            break
        p++
    } 
 
    return answer = p; 
cs