Capital One Interview Question

a technical leetcode question about array