Random Problem
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
@@ -0,0 +1,19 @@
class Solution {
static int arr[5001];
public:
int hIndex(vector<int> &citations) {
memset(arr, 0x00, sizeof(arr));
for (int n : citations) arr[n]++;
int total = 0;
for (int i = 5000; i >= 0; i--) {
total += arr[i];
if (total >= i) return i;
}
return -1;
}
};
int Solution::arr[5001] = {0};
@@ -219,6 +219,7 @@
for solving problems.
| 0263 | Easy | [Ugly Number](Problems/0263.cpp) |
| 0264 | Medium | [Ugly Number II](Problems/0264.cpp) |
| 0268 | Easy | [Missing Number](Problems/0268.cpp) |
| 0274 | Medium | [H-Index](Problems/0274.cpp) |
| 0278 | Easy | [First Bad Version](Problems/0278.cpp) |
| 0279 | Medium | [Perfect Squares](Problems/0279.cpp) |
| 0283 | Easy | [Move Zeroes](Problems/0283.cpp) |