Pergunta de entrevista da empresa INDPRO Engineering systems

Time and Space complexity for the loops in a difficult way.