h-index

Leetcode 274.H指数(H-Index)

心已入冬 提交于 2020-03-09 13:40:28
Leetcode 274.H指数 1 题目描述( Leetcode题目链接 )   给定一位研究者论文被引用次数的数组(被引用次数是非负整数)。编写一个方法,计算出研究者的 h 指数。   h 指数的定义: “h 代表“高引用次数”(high citations),一名科研人员的 h 指数是指他(她)的 (N 篇论文中)至少有 h 篇论文分别被引用了至少 h 次。(其余的 N - h 篇论文每篇被引用次数不多于 h 次。)” 输入 : citations = [ 3 , 0 , 6 , 1 , 5 ] 输出 : 3 解释 : 给定数组表示研究者总共有 5 篇论文,每篇论文相应的被引用了 3 , 0 , 6 , 1 , 5 次。 由于研究者有 3 篇论文每篇至少被引用了 3 次,其余两篇论文每篇被引用不多于 3 次,所以她的 h 指数是 3 。 2 题解   原文题目描述有些问题,参考英文描述更好。首先排序,排序后遍历数组,每次令 h = l e n g t h − i h=length-i h = l e n g t h − i 表示当前有 h h h 篇论文的引用次数大于等于 c i t a t i o n s [ i ] citations[i] c i t a t i o n s [ i ] ,所以当 h ≤ c i t a t i o n s [ i ] h\le

Leetcode 274. H-Index & Round H H-index-Kick Start 2019

半城伤御伤魂 提交于 2020-01-04 17:33:35
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index. According to the definition of h-index on Wikipedia: “A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more than h citations each.” Example: Input : citations = [3,0,6,1,5] Output : 3 Explanation : [3,0,6,1,5] means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3 citations each and

Baozi Leetcode solution 274: H-Index

早过忘川 提交于 2019-12-25 06:46:21
Problem Statement Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According to the definition of h-index on Wikipedia : "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more than h citations each." Example: Input: citations = [3,0,6,1,5] Output: 3 Explanation: [3,0,6,1,5] means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3

Baozi Leetcode solution 274: H-Index

荒凉一梦 提交于 2019-12-06 15:35:12
Problem Statement Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According to the definition of h-index on Wikipedia : "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more than h citations each." Example: Input: citations = [3,0,6,1,5] Output: 3 Explanation: [3,0,6,1,5] means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3

[LeetCode] 274. H-Index

时光总嘲笑我的痴心妄想 提交于 2019-12-02 17:21:58
H-Index是一个判断发表论文质量的参数。这个参数的定义是,如果作者发布了N篇论文,其中有h篇论文至少被引用了h次;剩下的论文的被引用次数都不超过h次。 Input: citations = [3,0,6,1,5] Output: 3 Explanation: [3,0,6,1,5] means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, her h-index is 3. 两种思路,第一种是排序;第二种是用到桶排序。 排序法:例子, [3,0,6,1,5] 按照从大到小排序,排序过后的数组为[6, 5, 3, 1, 0]。此时扫描数组,判断下标i是否 >= citation[i]。因为一共有n篇论文,所以判断的是是不是至少有i篇论文,被引用的次数大于等于i次。 时间O(nlogn) 空间O(1) 1 /** 2 * @param {number[]} citations 3