Pregunta de entrevista de AGDATA

You're given an easy logical problem to code.