Pergunta de entrevista da empresa Pocket Gems

DP question, graph problem, and code evaluation.