State Farm Interview Question

What is your approach to solve this coding question?