当前位置:网站首页>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];
}
}
边栏推荐
- Caché WebSocket
- Esp32-c3 introductory tutorial questions ⑫ - undefined reference to ROM_ temp_ to_ power, in function phy_ get_ romfunc_ addr
- 国元期货是正规平台吗?在国元期货开户安全吗?
- 学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
- Scala基础教程--12--读写数据
- Guys, for help, I use MySQL CDC 2.2.1 (Flink 1.14.5) to write Kafka and set
- Scala basic tutorial -- 17 -- Collection
- 1672. 最富有客户的资产总量
- Is Guoyuan futures a regular platform? Is it safe to open an account in Guoyuan futures?
- C语言打印练习
猜你喜欢

2022 ByteDance daily practice experience (Tiktok)

My colleagues quietly told me that flying Book notification can still play like this

更安全、更智能、更精致,长安Lumin完虐宏光MINI EV?

Learning path PHP -- phpstudy "hosts file does not exist or is blocked from opening" when creating the project

建立自己的网站(15)

学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”

奥迪AUDI EDI INVOIC发票报文详解

Scala基础教程--13--函数进阶

小发猫物联网平台搭建与应用模型

Scala basic tutorial -- 19 -- actor
随机推荐
Use canal and rocketmq to listen to MySQL binlog logs
Go microservice (II) - detailed introduction to protobuf
Scala基础教程--17--集合
Learning path PHP -- phpstudy "hosts file does not exist or is blocked from opening" when creating the project
C # implementation defines a set of SQL statements that can be executed across databases in the middle of SQL (detailed explanation of the case)
爬虫(6) - 网页数据解析(2) | BeautifulSoup4在爬虫中的使用
2014合肥市第三十一届青少年信息学奥林匹克竞赛(小学组)试题
Scala basic tutorial -- 14 -- implicit conversion
Mxnet implementation of googlenet (parallel connection network)
Li Kou brush question diary /day1/2022.6.23
6.26CF模拟赛E:价格最大化题解
Li Kou brush question diary /day2/2022.6.24
node_exporter部署
2022健康展,北京健博会,中国健康展,大健康展11月13日
Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
876. Intermediate node of linked list
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
Scala basic tutorial -- 19 -- actor
1672. 最富有客户的资产总量
2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import 'fmt' func