Pregunta de entrevista de JPMorganChase

2 Programming Tasks, somewhat difficult