Infosys Interview Question

coding question on binary search