1. 程式人生 > >LeetCode 274. H指數

LeetCode 274. H指數

span sort gin class tor ons for style int

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指數