Question d’entretien chez H E B

Standard algorithm question, nothing to difficult.