My Solution that beats 99.07% of java submission

  • 0

    The Idea is to first sort the citations. Start testing each citation if it is the hIndex value. For citation value to be the hIndex, the citation value of papers are required to support the citation.

       class Solution274 {
       public int hIndex(int[] citations) {    	
    	  int hi=0,hic=0;
    	  for(int i=0; i<citations.length; i++){
    		hic = Math.min(citations[i], citations.length-i);
    		hi = Math.max(hi, hic);    		
         return hi;


Log in to reply

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