Pergunta de entrevista da empresa IBM

Coding Question: Figuring out a condition for elements in an array