public int hIndex2(int[] citations) {
        if (citations == null) return 0;
        int n = citations.length;
        int low = 0, high = n - 1;
        while (low <= high) {
            int mid = (low + high) >> 1;
            if (n - mid == citations[mid]) {
                return n - mid;
            } else if (n - mid > citations[mid]) {
                low = mid + 1;
            } else {
                high = mid - 1;
            }
        }
        return n - low;
    }