Capital One interview question

Case Interview was challenging