Pregunta de entrevista de LexCheck

Was asked to solve two coding problems