Pergunta de entrevista da empresa Rocket Lawyer

There was this coding question in Typescript