Intuit interview question

Coding exercise to be resolved in 40 minutes.