BlackRock interview question

Write a binary search function