Arun Jacob
Oct 7, 2021

--

the solution section was not getting shown on the screen for some unknown reasons.. anyways the below would be fine(without the edge cases handled)....:)

*****

function myFunction(arr){

var len = arr.length;

for(var i = 0; i < len; i++){

var ele = arr[i],

nxt = i < len ? arr[i+1] : arr[i],

msn = 0;

if(nxt - ele > 1){

msn = ele + 1;

return [msn];

}

}

return [msn];

}

*******

--

--

Arun Jacob
Arun Jacob

Written by Arun Jacob

Tech. Enthusiast, develops user journeys for SAP Enterprise Applications.

No responses yet