Pregunta de entrevista de Yandex

They asked me some problem from LeetCode which was related to Binary Search.