Verisk Interview Question

Explain your thought process when developing this code.