This fails with negative numbers. How to implement when -ve numbers exists

The provided top down approach fails for this array input

Hi Rahul,

The problem only expect +ve numbers:

Given a set of positive numbers, find if we can partition it into two subsets such that the sum of elements in both the subsets is equal.

It would be a good exercise to consider -ve numbers. Although the current recursive solution works on your example, we need to modify the the DP solutions to take care of -ve numbers. It would be a completely new problem though, not following the 0/1 Knapsack pattern.

–Design Gurus team