Bloomberg Interview Question

Code the binary search