Amazon interview question

Variations on binary search