Pocket Gems Interview Question

dynamic programming, diamonds.