This commit is contained in:
2025-09-15 21:12:04 +08:00
commit 3f58f483ff
144 changed files with 5298 additions and 0 deletions

29
23/10/Q275.h Normal file
View File

@@ -0,0 +1,29 @@
//
// Created by 李洋 on 2023/10/30.
//
#ifndef LEECODE_C_Q275_H
#define LEECODE_C_Q275_H
#include <vector>
using namespace std;
class Q275 {
public:
int hIndex(vector<int> &citations) {
int n = citations.size();
int left = 0, right = n - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (citations[mid] >= n - mid) {
right = mid - 1;
} else {
left = mid + 1;
}
}
return n - left;
}
};
#endif //LEECODE_C_Q275_H