Domanda di colloquio di Cargomatic

given a sorted array, print the elements whose sum is equal to n.