Pregunta de entrevista de almatar

Solving an mid difficulty problem