当前位置:网站首页>H index problem
H index problem
2022-06-22 03:41:00 【Yu who wants to fly】
H Index
stem :
Given an array of times a researcher's paper is cited ( The number of references is a non negative integer ). Write a method , Calculate the researcher's h Index .
h The definition of index :h representative “ High citations ”(high citations), A researcher's h The index refers to him ( she ) Of (N In a paper ) All in all h At least one of the papers was cited h Time . And the rest N - h Number of citations per paper No more than h Time .
for example : Someone's h The index is 20, This means that in his published papers , Each article is quoted at least 20 There are a total of 20 piece .
Answer key :
class Solution {
public int hIndex(int[] citations) {
int length = citations.length;
for(int i=length;i>0;i--){
int k=0;
for(int j = 0;j<length;j++){
if(citations[j]>=i){
k++;
}
if(k>=i){
return k;
}
}
}
return 0;
}
}
Here is a simple and crude method , Direct double layer for Circular application , Outer layer for Cycle from large to small , Once found greater than i The direct return of .
边栏推荐
- Sword finger offer 68 - I. nearest common ancestor of binary search tree
- Decorator II property - short answer logic
- 美容院怎样做活动
- Simple introduction to thoroughly understand anti shake and throttling
- 倍福TwinCAT3控制器和控制器间的Ads通讯
- AtCoder Regular Contest 142
- Sword finger offer 68 - ii Nearest common ancestor of binary tree
- 关于在dialog中调用edittext这个件事
- EU5, eu7, EX3, Ex5 install third-party apps
- Attributes, comments and field information of fields in MySQL query table
猜你喜欢
随机推荐
Snappy format parsing
Atcoder beginer contest 252 (Dijkstra, reverse thinking)
How to read and write files efficiently
Magic method "six"__ enter__ And__ exit__
128陷阱——源码分析
3DE new simulation status
Runtime package for golang concurrent programming
3DE recover from design
Sword finger offer 68 - I. nearest common ancestor of binary search tree
所有项目的资源
如何高效的读写文件思考
倍福 PLC 字符串类型string操作
Use yolov5 to train your own data set; Installation and use of yolov5; Interpretation of yolov5 source code
Pointer and pointer of pointer
3de 机器人吸盘抓box
3de 移动物体的位置
svn与cvs的区别有哪些
MySQL 45 lecture notes (I) execution of an SQL statement
ASUS reinstallation system keyboard lamp failure = & gt; Refitting the ATK drive
GDB commissioning, use and sorting








