Amazon interview question

Coding question: binary search implementation