Capital One interview question

How would you go about making this code simpler? Basic Big(O) type questions for common data structures