Apple interview question

Coding challenge using binary search.