416 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:
这题其实是变相背包,先看能不能把total number切成2段,如果能,就求是否能背包成total/2.其实就是求有没有combination sum等于total/2
Last updated
Was this helpful?