The Peak of a Mountain Array

Could you please explain why below condition is required

mid == len(arr) - 1

Hi @Skyrim

Think of a case where the peak of the mountain lies at the last index of the array.
For example,
[0, 1, 2, 3, 4, 5, 6]

While updating mid and left, what if mid reaches the end of the array?
the condition mid == len(arr) - 1 is covering that case.