Gah, dynamic programming example is so cryptic