Credit Karma interview question

Medium leetcode question on arrays