Capital One Interview Question

Python - Leetcode arrays problem