Using DP we can find out.

Check my solution in javascript. It is basically using the logic to get all possible combination and verifying if there is a successful jump. If there is a successful jump. A true output would be displayed.

let arr = [1,2,3,4,3,1,4,0]; function canComplete(arr, index){ if(index == arr.length - 1 ){ return true; } let success = false; if(Math.abs(arr[index] - arr[index+1]) <= 2){ success = canComplete(arr, index + 1); } if(!success && Math.abs(arr[index] - arr[index+2]) <= 2){ success = canComplete(arr, index + 2); } return success; } console.log(canComplete(arr,0));