Internet Brands interview question

Dynamic Programming Problem