Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int hIndex(vector<int>& citations) {
- int n=citations.size();
- vector<int> h(n+1, 0);
- for(auto c: citations)
- h[min(n,c)]++;
- int ans=n;
- for(int sum=h[n]; sum<ans; sum+=h[ans])
- ans--;
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement