Pregunta de entrevista de Rocket Lawyer

There was this coding question in Typescript