Pergunta de entrevista da empresa Blibli

Recursive Problem and logic algorithm with a most efficient solution