Tarento interview question

1 Coding question based on the binary search