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指数
猜你喜欢
转载自www.cnblogs.com/lokianyu/p/9497612.html
今日推荐
周排行