Google Interview Question

simple two pointer question with some binary search