leetcode414
public class Solution {
public int ThirdMax(int[] nums) {
var third = ;
var list = nums.Distinct().OrderByDescending(x => x).ToList();
if (list.Count == )
{
third = ;
}
else if (list.Count >= && list.Count <= )
{
third = list[];
}
else
{
third = list[];
}
return third;
}
}
https://leetcode.com/problems/third-maximum-number/#/description
leetcode414的更多相关文章
- [Swift]LeetCode414. 第三大的数 | Third Maximum Number
Given a non-empty array of integers, return the third maximum number in this array. If it does not e ...
- 2017-3-4 leetcode 414 485 495
虽说周末要早起来着,但是日子过得有点奇怪,一不小心就忘掉了... leetcode414 https://leetcode.com/problems/third-maximum-number/?tab ...
随机推荐
- DCOS(centos 7.4/7.6)
https://dcos.io/releases/ https://downloads.dcos.io/dcos/stable/1.12.0/dcos_generate_config.sh https ...
- Coderforce-574C Bear and Poker(素数唯一分解定理)
题目大意:给出n个数,问能不能通过让所有的数都乘以2的任意幂或乘以3的任意幂,使这n个数全都相等. 题目分析:最终n个数都是相等的,假设那个数为x,根据素数唯一分解定理,x能分解成m*2p3q.所以, ...
- @pathVariable的作用
//url中的id 可通过@pathVariable绑定到函数的参数中
- Nginx 静态资源缓存配置
示例 # Media: images, icons, video, audio, HTC location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|m ...
- Winform开发之DataGridView事件和属性
DataDridView的事件和属性非常多,一一介绍还是不现实,这里借鉴一下园友和MSDN上的介绍吧 1.C#中 DataGridView 属性说明(转载) 2.MSDN上DataGridView事件 ...
- Mysql基本操作(远程登陆,启动,停止,重启,授权)
1.查看mysql版本 方法一:status; 方法二:select version(); 2.Mysql启动.停止.重启常用命令 a.启动方式 1.使用 service 启动: [root@loca ...
- A*专题训练
POJ2449 Remmarguts' Date UDF's capital consists of N stations. The hall is numbered S, while the sta ...
- nats 学习 集群ha 配置
nats 的ha 是一个mesh 的结构,有两个主要的参数 clusters routers 启动三分节点(单机) 共享变量 SERVERS=nats://127.0.0.1:6222,nats: ...
- 树莓派系列教程:安装系统与配置环境,使用PuTTy与VNC图形界面远程登录
本文所需物品清单: Raspberry Pi 3 Model B 主板.SD卡与读卡器(用于烧录系统) 资料整理来源在文尾 需要下载的资源与工具: 推荐系统-Raspbian 树莓派官方深度定制的硬件 ...
- VMware 11 安装 Mac OS X10.10
一.下载好以下软件--->http://pan.baidu.com/s/1qWDkTbe 1,VMware 11 2,unlocker203(装好VMware11后需要安装补丁unlocker才 ...