/**
* Given an array of number, group algebraic sequences with d=1
* [1,2,3,4,5,6] => true
* [1,2,4,5,6] => false
*/
var arr = [1,2,4,5,6];
const differenceAry = arr.slice(1).map(function(n, i) { return n - arr[i]; })
const isDifference= differenceAry.every(value => value == 1)
console.log(isDifference); // False
function makeArrayConsecutive2(statues) {
var rang = statues.sort(function (a, b){
return (a - b)
});
var some=0;
if(rang.length-1==0){
return 0;
}else{
for(i=0;i<=rang.length-2;i++){
some+=(rang[i+1]-rang[i]-1);
}
return some;
}
}
let arr = [1,2,4,5,6];
let differenceAry = arr.slice(1).map(function(n, i) { return n - arr[i]; })
let isDifference= differenceAry.every(value => value == 1)
console.log(isDifference);