Solve a medium-difficulty dynamic programming problem, such as finding the longest common subsequence or optimizing resource allocation.