Whitepages Interview Question

Medium to fairly difficult dynamic programming algorithm problem.