Simplify. (TX) interview question

They give me a dsa problem based on binary search