最长连续序列
class Solution {public int longestConsecutive(int[] nums) {if(nums.length == 0 || nums.length == 1){return nums.length;}Arrays.sort(nums);int count = 1;int max = 1;for(int i = 0; i < nums.length - 1; i++){if(nums[i+1] - nums[i] == 1){count++;if(count > max){max = count;}}else if(nums[i+1] == nums[i]){continue;}else{count = 1;}}return max;}
}