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

0% completed

Vote For New Content
Abdullah AlKheshen
Error/Mistake in the Algorithm Walkthrough

Abdullah AlKheshen

Jun 28, 2024

Compare 7 and -1, stop. high = 5.

The above line is wrong because as long as arr[hi] >= arr[hi-1] we decrement hi--;

7 >= -1 so hi should stop on -1 that is index 4 not at 7 with index 5

0

0

Comments
Comments

On this page