Knapsack problem, partition problem, or in general dynamic algorithm with negative numbers allowed
In the two examples you mention, the dynamic programming algorithms work just as well. Let's take partition as an example. The dynamic programming approach computes, for every $m$, the sums of all subsets of $\{w_1,\ldots,w_m\}$. This works just as well if negative numbers are allowed. The range of the table has to be modified accordingly, to account fo the largest possible positive and negative amounts. With knapsack it's similar, and I'll let you work out the details.