Pergunta de entrevista da empresa JPMorganChase

Typicall SD question and as standard coding problem.