Make Array Consecutive 2

The solution for “Make Array Consecutive 2” can be found here. The following code will assist you in solving the problem.

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; } }

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in