Hint if your code not working


#1

Dry Run for this test case -

1 2 3 4 5 6 5 4 3 1

Hint 2 -
Math.max(arr[i],arr[i+1]); for 6 5