Domanda di colloquio di SAP

leetcode question (i think it was a leetcode easy)