Domanda di colloquio di Bank BTPN

Simple algorithm puzzle that should be coded live