Tuesday common C++ interview problem: Calculate h-index. Given information about research paper citations as std::vector<int>, where each element represents the number of citations for a paper, calculate the h-index: https://lnkd.in/eBZrC3ku. Your solution should run in O(n). Solve it yourself: https://lnkd.in/epkSkbc8 Solution: https://lnkd.in/e6pyx2hv #cpp #cplusplus #coding #programming #dailybiteofcpp
Might also be possible to this in O(n) time O(1) memory if the array is allowed to be modified
NC State Student Government•1K followers
2yCool solution. I always approached this problem by binary searching over a fixed range to determine the h index.