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; } };