Google interview question

simple two pointer question with some binary search