educative.io

Giving wrong output

Hi ,

Thanks for your patterns of questions and awesome explanations.

While going through your solution, i found that for some of the inputs it’s gives ambiguous results and most of the time looping indefinitely.

for given input:{9,8,7,3,6,6,6,3,3,2,2,1,1,0} o/p: Execution is timing out.
input:{8,3,1,1,3,4}

This is not bitonic since arr[2] === arr[3]