Pregunta de entrevista de Pramp

Given a sorted array, return the first element that matches the index