Pergunta de entrevista da empresa Oracle

Optimize time and memory complexity for some algorithm