Capital One interview question

General case study involving refactoring