Pergunta de entrevista da empresa BBD

ten code challenge to solve in two hours.