Infosys interview question

coding question on binary search