Capital One Interview Question

How would you code the solution to this problem, and what is the run time?

Capital One Interview Question: How would you code the solution to this problem, and what is the run time? | Glassdoor