Pregunta de entrevista de PIMCO

Coding challenge by using the language you prefer.