Pergunta de entrevista da empresa MathWorks

Forgot the exact question, but it uses binary search and is not standard leetcode question.