弄清楚H指数的含义就行
代码:
class Solution {
public:
int hIndex(vector<int>& citations) {
sort(citations.rbegin(),citations.rend());//先逆序排序
for(int i=0;i<citations.size();i++){
if(citations[i]<i+1) return i;
}
return citations.size();
}
};