Domanda di colloquio di JPMorganChase

Both questions on simple array manipulation with straightforward optimizing