you give integer array arr from start index series jump the 1st 3rd 5th jump series call oddnumbered jump 2nd 4th 6th jump series call evennumbered jump Note jumps number indicesyou jump forward index index j j follow wayduring oddnumbered jump ie jump 1 3 5 jump index j arri arrj arrj small possible value if multiple index j jump small index jDuring evennumbered jump ie jump 2 4 6 jump index j arri arrj arrj large possible value if multiple index j jump small index jIt case index legal jumpsA start index good start index reach end array index arrlength 1 jumping number time possibly 0 oncereturn number good start index Example 1input arr 1013121415output 2explanation from start index 0 1st jump 2 arr2 small arr1 arr2 arr3 arr4 greater equal arr0 jump moreFrom start index 1 2 1st jump 3 jump moreFrom start index 3 1st jump 4 reach endfrom start index 4 reach end alreadyIn total 2 different start index 3 4 reach end number ofjumpsexample 2input arr 23114output 3explanation from start index 0 jump 1 2 3during 1st jump oddnumbered jump 1 arr1 small value arr1 arr2 arr3 arr4 greater equal arr0during 2nd jump evennumbered jump 1 2 arr2 large value arr2 arr3 arr4 equal arr1 arr3 large value 2 small index jump 2 3during 3rd jump oddnumbered jump 2 3 arr3 small value arr3 arr4 greater equal arr2We can not jump 3 4 start index 0 goodIn similar manner deduce thatfrom start index 1 jump 4 reach endfrom start index 2 jump 3 can not jump anymorefrom start index 3 jump 4 reach endfrom start index 4 endIn total 3 different start index 1 3 4 reach end somenumber jumpsExample 3Input arr 51342output 3explanation we reach end start index 1 2 4 constraints1 arrlength 2 1040 arri 105