State Farm interview question

What is your approach to solve this coding question?