Can Partition to Equal Sum Subsets
Given an array of positive integers, determine if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.
[ 1, 5, 11, 5 ]
Explanation. The array can be partitioned as [1, 5, 5] and [11] which both sum to 11.
[ 1, 2, 3, 5 ]
Explanation. It is not possible to partition this array into two subsets with equal sums.
[ 3, 3, 3, 3, 4 ]
Explanation. The array can be partitioned as [3, 3, 4] and [3, 3] which both sum to 10.
[ 1, 1 ]
Explanation. The array can be partitioned into two subsets [1] and [1], each summing to 1.
Follow-up: Could there be a solution that optimizes the space complexity beyond simply using an additional array to track subset sums?
All numbers in the input array are positive integers. The length of the array will be at least 2.