会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
π+1
博客园
首页
新随笔
联系
管理
订阅
2019年8月19日
给定一个无序的整数类型数组,求最长的连续元素序列的长度。 例如: 给出的数组为[100, 4, 200, 1, 3, 2], 最长的连续元素序列为[1, 2, 3, 4]. 返回这个序列的长度:4 你需要给出时间复杂度在O(n)之内的算法
摘要: import java.util.*; public class Solution { public int longestConsecutive(int[] num) { if( num==null || num.length == 0){ return 0; } if(num.length==1){ ...
阅读全文
posted @ 2019-08-19 09:50 紫色的雪
阅读(1203)
评论(0)
推荐(0)
公告