Intuit interview question

Q: Coding Question, medium difficulty