Nice, the same idea as mine, but with better complexity avoiding binsearch at all
3 Likes
Don’t worry, they’ll be added soon. I don’t have access to add them by myself.
Thanks mate.
How are we finding m using binary search ? Please explain ?
it can take such inputs
Great !!!
Can you explain why you subtracted (minLength)*(minLength) from totalSum?
What made you reach this conclusion?
I am not sure if I am missing something but where is it given that in the problem statement or constraints that the input will have only one peak? The solutions explained are based on this assumptions if I am not wrong.
For example if we take an input such as -
1 2 1 4 3 2 1
then the defined solution gives wrong answer.