H-Index | Leetcode Top Interview 150

Поділитися
Вставка
  • Опубліковано 18 вер 2024
  • Here we will discuss the most important data structures and algorithms questions which are usually asked in the top rated product based companies.
    About me - My name is Anurag Gupta. I have done my B.Tech. from IIT Roorkee. I have done software engineer internship at Amazon and I have 3 years of work experience as a Senior Software Engineer.
    Problem Link - leetcode.com/p...
    Problem Description - Given an array of integers citations where citations[i] is the number of citations a researcher received for their ith paper, return the researcher's h-index.
    According to the definition of h-index on Wikipedia: The h-index is defined as the maximum value of h such that the given researcher has published at least h papers that have each been cited at least h times.

КОМЕНТАРІ • 1

  • @CodingWithAnurag-1086
    @CodingWithAnurag-1086  2 місяці тому +1

    Code solution - class Solution {
    public:
    int hIndex(vector& citations) {
    int n = citations.size();
    int low = 0, high = 1000, ans= -1, mid, count;
    while(low= mid) {
    ans = mid;
    low = mid + 1;
    } else {
    high = mid - 1;
    }
    }
    return ans;
    }
    };