Capital One Interview Question

Array manipulation and dynamic programming.