Pergunta de entrevista da empresa John Deere

Coding problem dealing with arrays and loops