CIBC interview question

Was asked leetcode easy question