Bnary search -pivot element

if we move to chect third condition and the a[mid]==a[s]==a[e]…we will gwt -1;
consider this array as input a=[6,1,6,6,6,6,6]
code:-https://ide.codingblocks.com/s/192874

Yes this would form an edge case.The solution is correct only when duplicates are not allowed in the array.
In your case you would have to check for the pivot in both the halves after finding out the first mid ie at 3.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.