H-Index
public class Solution { public int hIndex(int[] citations) { if(citations == null || citations.length == 0) return 0; Arrays.sort(citations); // 0 1 3 5 6 for(int i = 0; i < citations.length; i++){ int index = citations.length - i; if(citations[i] >= index) return index; } return 0; } }
Leave A Comment