Question d’entretien chez SAP

leetcode question (i think it was a leetcode easy)