Pregunta de entrevista de Citi

given a case scenario and expected to code solution to it