Pergunta de entrevista da empresa TD

a challenge that i faced and how i solved it.