Domanda di colloquio di CIBC

Was asked leetcode easy question