LeetCode – H-Index II (Java)
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? Java Solution Given the array is sorted, we should use binary search. int hIndex(int[] citations) { int len = citations.length; if (len == 0) { return 0; } if (len == 1) { if … Read more