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 ...
随机推荐
- CSS的三种样式表和优先级
1.外部样式表当样式需要应用于很多页面时,外部样式表将是理想的选择.在使用外部样式表的情况下,你可以通过改变一个文件来改变整个站点的外观.每个页面使用 <link> 标签链接到样式表. & ...
- Python 实现图片上表格的写入
直接上代码:import matplotlib.pylab as pltimport numpy as npplt.figure()axes=plt.gca()y= np.random.randn(9 ...
- K-Means算法的收敛性和如何快速收敛超大的KMeans?
不多说,直接上干货! 面试很容易被问的:K-Means算法的收敛性. 在网上查阅了很多资料,并没有看到很清晰的解释,所以希望可以从K-Means与EM算法的关系,以及EM算法本身的收敛性证明中找到蛛丝 ...
- uva10689矩阵快速幂
#include<map> #include<set> #include<cmath> #include<queue> #include<stac ...
- snmpwalk-MIB of S5700-idc-stack
IF-MIB:.iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifDescrOID:.1.3.6.1.2.1.2.2.1.2 针 ...
- IOS-多线程(NSOperation)
一.基础用法 // // ViewController.m // IOS_0120_NSOperation // // Created by ma c on 16/1/20. // Copyright ...
- 物理内存不够用,临时增大Linux交换分区的方法
当系统的物理内存不够用的时候,就需要将物理内存中的一部分空间释放出来,以供当前运行的程序使用.那些被释放的空间可能来自一些很长时间没有什么 操作的程序,这些被释放的空间被临时保存到Swap空间中,等到 ...
- MVC4 绑定下拉框方法,解决编辑时不绑定值
方法一 Controller 部分代码: public ActionResult Modify(int id) { //3.1.1 检查id //3.1.2根据id查询数据 Models.Stude ...
- Alpha阶段第1周 Scrum立会报告+燃尽图 02
作业要求与https://edu.cnblogs.com/campus/nenu/2018fall/homework/2246相同 一.小组介绍 组长:刘莹莹 组员:朱珅莹 孙韦男 祝玮琦 王玉潘 周 ...
- 理解 python 装饰器
变量 name = 'world' x = 3 变量是代表某个值的名字 函数 def hello(name): return 'hello' + name hello('word) hello wor ...