import java.util.*; public class Solution { /** * max increasing subsequence * @param arr int整型一维数组 the array * @return int整型 */ public int MLS (int[] arr) { if(arr.length <= 1) return 1 ; Arrays.sort(arr) ; int i = 1 ; int maxLen = 1 ; int len = 1 ; while(i < arr.length) { if(arr[i] == arr[i-1] + 1) { len ++ ; if(len > maxLen) maxLen = len ; } else if(arr[i] > arr[i-1] + 1) { len = 1 ; } i ++ ; } return maxLen ; } }