H-Index (for JAVA)

Sunyoung·2021년 5월 20일
0
import java.util.*;

class Solution {
    public int solution(int[] citations) {
        int answer = 0;
        Arrays.sort(citations);
        for (int i = 0;i<citations.length;i++) {
            int h = citations.length - i;
            if(citations[i] >= h) {
                return h;
            }
        } 
        return answer;
    }
}

실제로 사용되는 전문용어 인 h-index는 로직자체는 정말 심플한데 이를 바로 알고리즘으로 풀어내기가 쉽지 않다 그래서 위키피디아 보고 로직 찾음
찾아보니 논문 수 많은 학자들은 g-index 를 사용하기도 한다함

https://en.wikipedia.org/wiki/H-index

profile
배워서 남주자

0개의 댓글