国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

LeetCode 414 --- Third Maximum Number

2019-11-08 02:18:25
字體:
供稿:網(wǎng)友

題目鏈接: LeetCode 414 — Third Maximum Number

AC代碼:

public class PRoblem414 { public static void main(String[] args) { // TODO Auto-generated method stub int[] aa={2,2,3,1}; thirdMax(aa); } public static int thirdMax(int[] nums) { int a=-1;int b=-1;int c=-1; for(int i=0;i<nums.length;i++){ if(c==-1) { c=i; } else{ if(nums[i]>nums[c]) { a=b; b=c; c=i; } else if(nums[i]==nums[c]) continue; else{ if(b==-1) { b=i; } else{ if(nums[i]>nums[b]){ a=b; b=i; } else if(nums[i]==nums[b]) continue; else { if(a==-1) { a=i; } else{ if(nums[i]>nums[a]){ a=i; } else continue; } } } } } } if(a==-1) return nums[c]; else return nums[a]; }}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 个旧市| 十堰市| 福贡县| 松潘县| 蕲春县| 龙胜| 新绛县| 永丰县| 九龙城区| 孙吴县| 凤庆县| 邯郸县| 上林县| 东乌| 合肥市| 兰考县| 鹤峰县| 隆化县| 宁城县| 石景山区| 大安市| 西乌珠穆沁旗| 临高县| 海阳市| 兰考县| 西乌珠穆沁旗| 四平市| 油尖旺区| 屏山县| 高密市| 九寨沟县| 河池市| 丰台区| 全南县| 炉霍县| 雅江县| 万州区| 信宜市| 光山县| 海盐县| 邯郸县|