当前位置:网站首页>The kth largest element in the array
The kth largest element in the array
2022-07-04 19:21:00 【charlsdm】
- The... In the array K The biggest element
Given an array of integers nums And integer k, Please return the... In the array k The biggest element .
Please note that , What you need to look for is the number after array sorting k The biggest element , Not the first. k A different element .
Example 1:
Input : [3,2,1,5,6,4] and k = 2
Output : 5
Example 2:
Input : [3,2,3,1,2,4,5,5,6] and k = 4
Output : 4
my C#AC Code ` public partial class Solution
{
public int FindKthLargest(int[] nums, int k)
{
List<int> mynums = nums.ToList();
mynums.Sort();
mynums.Reverse();
return mynums[k-1];
}
}
边栏推荐
- 基于unity的愤怒的小鸟设计
- .NET ORM框架HiSql实战-第二章-使用Hisql实现菜单管理(增删改查)
- Li Kou brush question diary /day3/2022.6.25
- 6.26CF模拟赛E:价格最大化题解
- [go ~ 0 to 1] read, write and create files on the sixth day
- 启牛开的证券账户安全吗?
- C # implementation defines a set of SQL statements that can be executed across databases in the middle of SQL (detailed explanation of the case)
- Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
- 基于C语言的菜鸟驿站管理系统
- Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
猜你喜欢
Mxnet implementation of googlenet (parallel connection network)
整理混乱的头文件,我用include what you use
Wireshark packet capturing TLS protocol bar displays version inconsistency
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
神经网络物联网平台搭建(物联网平台搭建实战教程)
Scala基础教程--18--集合(二)
与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用
Nebula importer data import practice
Scala基础教程--19--Actor
自由小兵儿
随机推荐
6.26cf simulation match B: solution to array reduction problem
1672. 最富有客户的资产总量
基于NCF的多模块协同实例
Nebula importer data import practice
LeetCode第300场周赛(20220703)
【OpenCV入门到精通之九】OpenCV之视频截取、图片与视频互转
模板_判断素数_开方 / 六素数法
C语言打印练习
Lex and yacc based lexical analyzer + parser
2022健康展,北京健博会,中国健康展,大健康展11月13日
Scala基础教程--15--递归
模板_大整数减法_无论大小关系
26. 删除有序数组中的重复项 C#解答
2021 合肥市信息学竞赛小学组
Scala basic tutorial -- 19 -- actor
更安全、更智能、更精致,长安Lumin完虐宏光MINI EV?
千万不要只学 Oracle、MySQL!
2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import 'fmt' func
国元期货是正规平台吗?在国元期货开户安全吗?
问下各位大佬有用过cdc直接mysql to clickhouse的么