Pergunta de entrevista da empresa Apple

what is wrong with this program?