Pregunta de entrevista de Ancestry

Coding question- medium difficulty level questions from hacker rank/leet