SiteHost interview question

how to solve the assignment