Domanda di colloquio di Acorns

Find if this array has x. We talked about optimization in this question.