Amazon interview question

binary search leet code problem