leetcode 274H-index
public int hIndex(int[] citations) {
        /*
        唠唠叨叨说了很多   其实找到一个数h,使得数组中至少有h个数大于等于这个数,
        其他N-h个数小于这个数,h可能有多个,求最大的那个
         */
        if (citations.length==0)
            return 0;
        //sort方法是将原数组排序,会改变原数组
        Arrays.sort(citations);
        int res = 0;
        for (int i = citations.length-1; i >=0 ; i--) {
            if (citations[i]>=citations.length-i)
            {
                res++;
            }
            else
                break;
        }
        return res;
    }
leetcode 274H-index的更多相关文章
- [LeetCode] Minimum Index Sum of Two Lists 两个表单的最小坐标和
		Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite ... 
- LeetCode Minimum Index Sum of Two Lists
		原题链接在这里:https://leetcode.com/problems/minimum-index-sum-of-two-lists/description/ 题目: Suppose Andy a ... 
- [LeetCode] Peak Index in a Mountain Array 山形数组的顶峰坐标
		Let's call an array A a mountain if the following properties hold: A.length >= 3 There exists som ... 
- [LeetCode] Random Pick Index 随机拾取序列
		Given an array of integers with possible duplicates, randomly output the index of a given target num ... 
- LeetCode 599. Minimum Index Sum of Two Lists (从两个lists里找到相同的并且位置总和最靠前的)
		Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite ... 
- [LeetCode] Find Pivot Index 寻找中枢点
		Given an array of integers nums, write a method that returns the "pivot" index of this arr ... 
- LeetCode 852. Peak Index in a Mountain Array C++ 解题报告
		852. Peak Index in a Mountain Array -- Easy 方法一:二分查找 int peakIndexInMountainArray(vector<int>& ... 
- Leetcode之二分法专题-852. 山脉数组的峰顶索引(Peak Index in a Mountain Array)
		Leetcode之二分法专题-852. 山脉数组的峰顶索引(Peak Index in a Mountain Array) 我们把符合下列属性的数组 A 称作山脉: A.length >= 3 ... 
- LeetCode 599: 两个列表的最小索引总和   Minimum Index Sum of Two Lists
		题目: 假设 Andy 和 Doris 想在晚餐时选择一家餐厅,并且他们都有一个表示最喜爱餐厅的列表,每个餐厅的名字用字符串表示. Suppose Andy and Doris want to cho ... 
- [LeetCode] 880. Decoded String at Index 在位置坐标处解码字符串
		An encoded string S is given. To find and write the decoded string to a tape, the encoded string is ... 
随机推荐
- 【SHOI2008】JZOJ2020年9月5日提高组 循环的债务
			CSP-2020倒计时:36天 [SHOI2008]JZOJ2020年9月5日提高组 循环的债务 题目 Description Alice.Bob和Cynthia总是为他们之间混乱的债务而烦恼,终于有 ... 
- 解决 spring-integration-mqtt 频繁报 Lost connection 错误
			问题描述 在之前的博客介绍了如何在 Spring Boot 集成 MQTT,后面使用中没有发现问题,最近发现一直报错: Lost connection: Connection lost; retryi ... 
- 在django中使用原生sql语句
			raw # row方法:(掺杂着原生sql和orm来执行的操作) res = CookBook.objects.raw('select id as nid from epos_cookbook whe ... 
- pytorch实战(一)hw1——李宏毅老师作业1
			任务描述:利用前9小时数据,预测第10小时的pm2.5的数值,回归任务 kaggle地址:https://www.kaggle.com/c/ml2020spring-hw1 训练集为: 12个月*20 ... 
- go学习49天
			写文件操作 func OpenFile(name string,flag int,perm FileMode) (file *File,err error) 
- ip 子网掩码、网络地址、广播地址计算
			例:已知ip 16.158.165.91/22子网掩码 根据22 得知子网掩码占22位 即:11111111.11111111.11111100.00000000 == 255.255.252. ... 
- 【NOI2019】弹跳(KDT优化建图)
			Description 平面上有 \(n\) 个点,分布在 \(w \times h\) 的网格上.有 \(m\) 个弹跳装置,由一个六元组描述.第 \(i\) 个装置有参数:\((p_i, t_i, ... 
- RDD、DF和DS的共性与区别
			共性: 1.都是spark平台下的分布式弹性数据集 2.都有惰性机制,创建.转换如map操作时不会立即执行,遇到foreach等Action算子时才开始运算. 3.都会自动缓存计算 4.都有parti ... 
- sqli-labs less-24(二次注入)
			less-24 原理: 在网站处理用户提交的数据的时候,只是将某些敏感字符进行了转义.因而使得用户第一次提交的时候不会被当做代码执行.但是这些数据存入数据库的时候却没有转义,而网站程序默认数据库中的数 ... 
- 【Python】 requests  各种参数请求的方式
			Python使用requests发送post请求 1.我们使用postman进行接口测试的时候,发现POST请求方式的编码有3种,具体的编码方式如下: A:application/x-www-form ... 
