Pergunta de entrevista da empresa Apple

Code optimization of an existing code printed on a paper