Pregunta de entrevista de Academia.edu

Slight twist on a well known coding problem