275. H-Index II

来源:互联网 发布:浏览器连接不上网络 编辑:程序博客网 时间:2024/05/22 10:49
public class Solution {    public int hIndex(int[] c) {        int ret = 0;        for(int i = c.length-1;i>=0;i--){            if(ret+1<=c[i])ret++;        }        return ret;    }}

Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm?
0 0
原创粉丝点击