help!!!what's wrong with this one


  • 0
    D

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

    return h;}
    

    }


Log in to reply
 

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