Pergunta de entrevista da empresa Thoughtworks

First and second were coding rounds