File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 17
17
1 . [ Path Sum III] ( https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3417/ ) ➡️ [ CPP Solution] ( Week2/pathSum.cpp )
18
18
2 . [ Rotting Oranges] ( https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3418/ ) ➡️ [ CPP Solution] ( Week2/orangesRotting.cpp )
19
19
3 . [ Excel Sheet Column Number] ( https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3419/ ) ➡️ [ CPP Solution] ( Week2/titleToNumber.cpp )
20
+ 4 . [ H Index] ( https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3420/ ) ➡️ [ CPP Solution] ( Week2/hIndex.cpp )
20
21
21
22
## Where to find me? 🌟
22
23
* [ Website] ( https://akashwho.codes/ )
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ public:
3
+ int hIndex (vector<int >& citations) {
4
+ int n = citations.size ();
5
+ sort (citations.begin (), citations.end ());
6
+
7
+ for (int i = 0 ; i < n; ++i) {
8
+ if (citations[i] >= n - i) {
9
+ return n - i;
10
+ }
11
+ }
12
+
13
+ return 0 ;
14
+ }
15
+ };
You can’t perform that action at this time.
0 commit comments