Capital One Interview Question

Algorithm based questions in Python