LeetCode 274. H指数

Posted lokianyu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode 274. H指数相关的知识,希望对你有一定的参考价值。

bool cmp (int i,int j) { return (i>j);}
class Solution {
public:
    int hIndex(vector<int>& citations) {


        int count = 0;
        sort(citations.begin(),citations.end(),cmp);
        for(int i = 0; i < citations.size(); i++){
            if(citations[i]>count)
                count++;
            else
                break;
        }
        return count;
    }
};

 

以上是关于LeetCode 274. H指数的主要内容,如果未能解决你的问题,请参考以下文章