博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
275. H-Index II
阅读量:7104 次
发布时间:2019-06-28

本文共 656 字,大约阅读时间需要 2 分钟。

class Solution {public:    int hIndex(vector
& citations) { if (citations.size() == 0) return 0; int i = 0, j = citations.size(); while (i < j - 1) { int m = i + (j - i) / 2; int pos = citations.size() - m; if (m == citations[pos]) return m; else if (m > citations[pos]) j = m; else i = m; } if (j == citations.size() && citations[0] >= citations.size() || citations[citations.size() - j] >= j) return j; return i; }};

 

转载于:https://www.cnblogs.com/JTechRoad/p/9071894.html

你可能感兴趣的文章
mysql 远程连接数据库的二种方法
查看>>
[你必须知道的.NET]第二十一回:认识全面的null
查看>>
Lexus Extroic OpenCart 2.X 自适应主题模板 ABC-0648-01
查看>>
awk案例
查看>>
linux中vmstat命令详解
查看>>
软件测试基础知识整理三----白盒测试
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
查看>>
linux网卡操作命令 ,查看Linux下网卡连接状态(up还是down)?
查看>>
CCNP学习之路之RSTP快速生成树协议
查看>>
yum安装与源码安装比较
查看>>
【C语言】第一个C语言小程序 —— 日期算法和万年历
查看>>
《高性能MySQL》學習筆記--索引
查看>>
BZOJ4894:天赋(矩阵树定理)
查看>>
Linux自动执行sh脚本
查看>>
转:消息队列
查看>>
Ansible
查看>>
软件测试Lab2 Selenium及自动化测试
查看>>
ubuntu配置lamp运行环境笔记
查看>>