American Express interview question

Basics of oops