# LeetCode 274. H-Index

Problem:

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.”

For example, given `citations = [3, 0, 6, 1, 5]`, which 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, his h-index is `3`.

Note: If there are several possible values for `h`, the maximum one is taken as the h-index.

Hint:

1. An easy approach is to sort the array first.
2. What are the possible values of h-index?
3. A faster approach is to use extra space.

Solution:

```public class Solution {
public int hIndex(int[] citations) {
Arrays.sort(citations);
int h = citations.length;
for (int i = 0; i < citations.length; i++) {
if (citations[i] >= h) return h;
h--;
}
return 0;
}
}
```

## 18 thoughts on “LeetCode 274. H-Index”

1. Like!! I blog quite often and I genuinely thank you for your information. The article has truly peaked my interest.

2. Dear you are comprehensive in your thoughts. I have made something for guys to find their life partner. Please check my blog and share with people who need this guide.

3. 除皺特點 純度高，效果好 見效迅速，無創無痛 安全精準，表情自然 唯一在臨床有20多年的注射材料，全球超過11000000人使用 適用範圍 魚尾紋、額頭紋、眉間紋、鼻紋和頸部皺紋都可以祛除； 最適合於早期的、不太明顯的皺紋 不須使用任何的鎮靜劑或局部麻醉劑，且Botox除皺治療後可立即繼續進行正常的活動。 Botox除皺可以利用午休時間約診即可，完全不影響工作的安排。BOTOX肉毒桿菌素是一種高度純化的蛋白質，經過注射之後，能夠使導致動態皺紋的肌肉得到放鬆，它能夠阻斷導致肌肉收縮的神經細胞，使面部線條變得平滑並防止新皺紋形成。全球銷量第一品牌 在中國唯一獲得SFDA、FDA批准用於醫療美容的肉毒桿菌素 唯一一個擁有40年安全記錄的肉毒桿菌素 在70個國家獲得批准使用 BOTOX肉毒杆菌素

4. 有關雷射、雷射除刺青、斑、曬斑、老人斑、太田母斑、顴骨母斑、點痣、疤痕、Q-開關紅寶石雷射、Q-開關釹-雅各雷射、Q-開關亞歷山卓雷射、二氧化碳雷射、鉺雅各雷射等一些相關、似是而非或有爭議的事項的披露與討論。

5. Great write-up, I am normal visitor of one’s site, maintain up the excellent operate, and It’s going to be a regular visitor for a long time.

6. Elizabeth Arden 伊麗莎白雅頓 【彩妝系列】冰紛甜心冰淇淋唇膏的商品介紹 UrCosme (＠cosme TAIWAN) 商品資訊 Elizabeth Arden 伊麗莎白雅頓,彩妝系列,冰紛甜心冰淇淋唇膏，有網友推薦最新1

7. FANCL 【彩妝系列】晶透瓷肌蜜粉的商品介紹 UrCosme (＠cosme TAIWAN) 商品資訊 FANCL,彩妝系列,晶透瓷肌蜜粉9

8. Terms & Disclaimer Marie Claire (HK) Edition 豁免條款 南華傳媒清楚明示不提供任何明示或默示的擔保，包含但不限於商業適售性、特定目的之適用性及未侵害他人權利。 南華傳媒不保証此網頁的資訊、產品及服務將符合您的要求，或該資訊、產品及服務及其使用及取得之結果不受干擾、及時提供、正確、安全可靠或免於出錯。南華傳媒亦不保証軟體及硬體中的任何錯誤都將得到更正。 南華傳媒不負責，亦不承擔任何一切因使用此網頁而引致之任何意外、錯誤、遺漏、疏忽、干擾、經傳送或接收的錯誤、因下載而感染電腦病毒、誹謗、合約毀壞、版權或知識產權侵犯及所造成的任何損失。 南華傳媒不承擔任何經由或透過此網頁購買或取得之任何資訊、產品及服務，或接收之訊息，或進行之交易所衍生之替代商品及服務之購買成本，及您的傳輸或資料遭到未獲授權的存取或變造，所帶來之直接、間接、附帶、特別、衍生性或懲罰性賠償。 免責聲明的中、英文本出現分歧，以英文文本為準。   DISCLAIMER

9. Manchester United hope they can lure the 27-year-old to Old Trafford as they continue their fight on four fronts and aim to challenge Manchester City for the Premier League title. Manchester United ‘to step up pursuit’ of Tottenham star Danny Rose as Jose Mourinho seeks January deal

10. The Frenchman departed Manchester United’s US tour on Wednesday to be by the side of his heavily pregnant girlfriend Melanie Da Cruz, who went into labour shortly after his return. ‘I am Swan Anthony Martial’: Manchester United star confirms arrival and name of baby boy after arriving in Paris just in time to witness birth following his exit from US tour

12. […] We’ve already done a few things to this space since moving in a little over a year ago including painting the walls white, replacing the range, switching out the light fixture, and adding under/over cabinet lighting. […]

13. My brother suggested I might like this website. He was entirely
right. This post truly made my day. You can not imagine just how much time I
had spent for this info! Thanks!

14. Jordan 12 Gym Red 2018 http://www.jordan12gymred.us.com/
Nike Outlet satore http://www.nikefactoryoutletstoreonline.com/
nike factory outlet http://www.nikefactoryoutletstoreonline.us/
Nike Outlet http://www.nikestores.us.com/
air jordan 33 http://www.jordan33.us/
cheapjerseysfromchina http://www.cheapjerseysfromchina.us/
custom nfl jerseys http://www.customnfljerseys.us/
air jordan 11 concord http://www.jordan11concord.us.com/
Jordan 12 Gym Red http://www.jordan12gymred.us/
Jordan 12 Gym Red 2018 http://www.redjordan12.us/
Yeezys http://www.yeezy.com.co/
Yeezys http://www.yeezys.us.com/
Yeezy Shoes http://www.yeezysupply.us.com/
Yeezy Shoes http://www.yeezy-shoes.us.com/
Yeezy Boost http://www.yeezy-boost350.com/
Yeezy Boost 350 V2 http://www.yeezyboost350.us.com/
Yeezy Boost 350 V2 Blue Tint http://www.yeezybluetint.com/
Yeezy 500 Utility Black http://www.yeezy500utilityblack.com/
Yeezy 500 Utility Black http://www.yeezy500utilityblack.us/
Nike Air VaporMax http://www.vapor-max.org.uk/
Salomon http://www.salomon-shoes.org.uk/
Salomon http://www.salomons.me.uk/
Salomon Shoes http://www.salomonspeedcross4.org.uk/
Off White Jordan http://www.offwhitejordan1.com/
Vapor Max http://www.nikevapormax.org.uk/
Nike React Element 87 http://www.nikereactelement87.us.com/
Nike Element 87 http://www.nikereactelement87.us/
Nike Air Vapormax Plus http://www.nikeplus.us/
Nike Outlet Store http://www.nike–outlet.us/
Nike Outlet http://www.nikeoutletstoreonlineshopping.us/
Nike Outlet http://www.nikeoutletonlineshopping.us/
Nike NBA Jerseys http://www.nikenbajerseys.us/
Air Max 97 http://www.nikeairmax.us/
Air Max 2017 http://www.max2017.us/
Air Jordan Shoes http://www.jordan-com.com/
Jordan 11 Concord 2018 http://www.jordan11-concord.com/
Cheap Yeezy Shoes http://www.cs7boots1.com/
Wholesale Cheap NBA Jerseys http://www.cheapnba-jerseys.us/
Birkenstock UK http://www.birkenstocksandalsuk.me.uk/