Why is my code can pass in eclipse but not in leetcode?


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

Log in to reply
 

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