Skip to content

Commit 9be73d1

Browse files
August: Day 11
1 parent fe8a8f8 commit 9be73d1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

LeetCode/H-Index.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
//
1+
class Solution {
2+
public:
3+
int hIndex(vector<int>& citations) {
4+
sort(citations.rbegin(), citations.rend());
5+
int ans = 0;
6+
for(int i = 0; i < citations.size(); i++)
7+
if(citations[i]>i) ans++;
8+
return ans;
9+
}
10+
};

0 commit comments

Comments
 (0)