Pocket Gems interview question

dynamic programming, diamonds.