Pocket Gems interview question

DP question, graph problem, and code evaluation.