Skip to content

Latest commit

 

History

History
9 lines (8 loc) · 307 Bytes

README.md

File metadata and controls

9 lines (8 loc) · 307 Bytes

Solution

If the input array is sorted we can use binary search to find the h index.

                           [0, 1, 3, 5, 6]
index                       0  1  2  3  4
f(x)= # of elements >= x    5  4  3  2  1
                            T  T  T  F  F

time: O(logn)
space: O(1)