Bloomberg interview question

Code the binary search