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?