Stockly interview question

a very classical binary search question