* max increasing subsequence
* @param arr int整型一维数组 the array
* @return int整型
*/
function MLS( arr ) {
// write code here
arr.sort(function(a,b){return a - b;});
if(arr.length <= 1)
return arr.length;
let num = 1,max = 1;
for(let i = 1;i < arr.length;i++){
if(arr[i] == arr[i - 1]) continue;
if(arr[i] == arr[i - 1] + 1){
num++;
}else{
num = 1;
}
if(num > max) max = num;
}
return max;
}
module.exports = {
MLS : MLS
};