275. H-Index II

public class Solution {
    public int hIndex(int[] citations) {
        int answer=0;
        int size=citations.length;
        for(int i=0;i<size;i++)
        {
            int temp=0;
            if(citations[i]<=size-i)
                temp=citations[i];
            else
                temp=size-i;
            answer=answer>temp?answer:temp;
        }
        return answer;
        
    }
}

 

posted @ 2016-07-12 17:21  阿怪123  阅读(139)  评论(0编辑  收藏  举报