Walmart interview question

code for binary search algorithm