leetcode274.H指数

直接排序完后进行遍历

java 复制代码
class Solution {
    public int hIndex(int[] citations) {
        Arrays.sort(citations);
        int result = 0;
        for (int i = citations.length-1; i >=0; i--) {
            if(citations[i]>=citations.length-i)
                result=citations.length-i;
            else
                break;
        }
        return result;
    }
}
相关推荐
CHANG_THE_WORLD2 小时前
金字塔降低采样
算法·金字塔采样
hqxstudying2 小时前
Java异常处理
java·开发语言·安全·异常
不知天地为何吴女士4 小时前
Day32| 509. 斐波那契数、70. 爬楼梯、746. 使用最小花费爬楼梯
算法
小坏坏的大世界4 小时前
C++ STL常用容器总结(vector, deque, list, map, set)
c++·算法
我命由我123455 小时前
Kotlin 数据容器 - List(List 概述、创建 List、List 核心特性、List 元素访问、List 遍历)
java·开发语言·jvm·windows·java-ee·kotlin·list
励志要当大牛的小白菜6 小时前
ART配对软件使用
开发语言·c++·qt·算法
qq_513970446 小时前
力扣 hot100 Day56
算法·leetcode
武子康7 小时前
Java-80 深入浅出 RPC Dubbo 动态服务降级:从雪崩防护到配置中心秒级生效
java·分布式·后端·spring·微服务·rpc·dubbo
PAK向日葵7 小时前
【算法导论】如何攻克一道Hard难度的LeetCode题?以「寻找两个正序数组的中位数」为例
c++·算法·面试
爱喝矿泉水的猛男9 小时前
非定长滑动窗口(持续更新)
算法·leetcode·职场和发展