American Express Interview Question

Explain your solution to the assignment