Urban Insight interview question

Complete the following programming challenge.