import java.util.*;
public class Solution {
/**
* max increasing subsequence
* @param arr int整型一维数组 the array
* @return int整型
*/
public int MLS(int[] arr) {
// write code here
Arrays.sort(arr);
int res = 1;
int previousVal = arr[0];
int num = 1;
for (int i = 1; i < arr.length; i++) {
int currentVal = arr[i];
if (currentVal == previousVal) {
continue;
} else if (currentVal - previousVal == 1) {
num++;
previousVal = currentVal;
} else {
res = Math.max(res, num);
num = 1;
previousVal = currentVal;
}
}
res = Math.max(res, num);
return res;
}
}