Partition Equal Subset Sum
Given anon-emptyarray containingonly positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.
Note:
Each of the array element will not exceed 100.
The array size will not exceed 200.
Example 1:
Example 2:
分析
01背包需要倒序,因为使用滚动数组,所以数组是一维的,d[i]需要从前一个d[i-1]得到,因此需要倒序。
Last updated