Pregunta de entrevista de Vaticle

Coding question in a statically typed language.