Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Why and how do the 2 points mentioned in the solution guarantee that the final r...

J

Dec 7, 2022

Why and how do the 2 points mentioned in the solution guarantee that the final result or array max is at arr[start] or arr[end] when start == end?

0

0

Comments
Comments
Design Gurus
Design Gurus3 years ago

Assuming, by 2 points, you meant the if-else part.

Assuming, you understand that when the 'while' loop finishes, start == end

Try understanding it with two elements array. (As in the end you will be left with two elements with binary search).

Let's say our array is ...

On this page