Pergunta de entrevista da empresa Whitepages

Medium to fairly difficult dynamic programming algorithm problem.