Dynamic-programming patterns that build solutions over successive prefixes.