Leetcode – 274. H-Index

/**
* @param {number[]} citations
* @return {number}
*/
var hIndex = function(citations) {

for(let h = citations.length ; h>0;h– ){
let count = 0
for(let i= 0 ; i <citations.length;i++){

if(citations[i]-h &g…


This content originally appeared on DEV Community and was authored by Rakesh Reddy Peddamallu

/**
 * @param {number[]} citations
 * @return {number}
 */
var hIndex = function(citations) {

   for(let h = citations.length ; h>0;h-- ){
        let count = 0 
        for(let i= 0 ; i <citations.length;i++){

            if(citations[i]-h >=0){
                count++;
            }

        }
        if(count >= h){
            return h
        }
   }
   return 0
};


This content originally appeared on DEV Community and was authored by Rakesh Reddy Peddamallu


Print Share Comment Cite Upload Translate Updates
APA

Rakesh Reddy Peddamallu | Sciencx (2025-01-26T05:03:00+00:00) Leetcode – 274. H-Index. Retrieved from https://www.scien.cx/2025/01/26/leetcode-274-h-index/

MLA
" » Leetcode – 274. H-Index." Rakesh Reddy Peddamallu | Sciencx - Sunday January 26, 2025, https://www.scien.cx/2025/01/26/leetcode-274-h-index/
HARVARD
Rakesh Reddy Peddamallu | Sciencx Sunday January 26, 2025 » Leetcode – 274. H-Index., viewed ,<https://www.scien.cx/2025/01/26/leetcode-274-h-index/>
VANCOUVER
Rakesh Reddy Peddamallu | Sciencx - » Leetcode – 274. H-Index. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/26/leetcode-274-h-index/
CHICAGO
" » Leetcode – 274. H-Index." Rakesh Reddy Peddamallu | Sciencx - Accessed . https://www.scien.cx/2025/01/26/leetcode-274-h-index/
IEEE
" » Leetcode – 274. H-Index." Rakesh Reddy Peddamallu | Sciencx [Online]. Available: https://www.scien.cx/2025/01/26/leetcode-274-h-index/. [Accessed: ]
rf:citation
» Leetcode – 274. H-Index | Rakesh Reddy Peddamallu | Sciencx | https://www.scien.cx/2025/01/26/leetcode-274-h-index/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.