Very Simple Java solution


  • 0
    Y
    public int hIndex(int[] citations) {
            Arrays.sort(citations);
            for (int i = 0; i < citations.length; i++) {
                if (citations[i] >= citations.length - i) return citations.length - i;
            }
            return 0;
        }
    

Log in to reply
 

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