赞
踩
题目:
题解:
- class Solution {
- public int hIndex(int[] citations) {
- int n = citations.length;
- int left = 0, right = n - 1;
- while (left <= right) {
- int mid = left + (right - left) / 2;
- if (citations[mid] >= n - mid) {
- right = mid - 1;
- } else {
- left = mid + 1;
- }
- }
- return n - left;
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。