6-line Simple Java Solution

  • 0

    Find the first h index which has the citation value larger or equal to the remaining # of citations.

    public int hIndex(int[] citations) {
        int num = citations.length;
        for(int h = 0; h < citations.length; h++){
            if(num - h <= citations[h])   return num - h;
        return 0;


Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.