#K34582. Partition Array into Two Equal Sum Subsets
Partition Array into Two Equal Sum Subsets
Partition Array into Two Equal Sum Subsets
Given an array of positive integers, determine whether it can be partitioned into two subsets such that the sum of the elements in both subsets is equal. This is equivalent to finding a subset \(S\) of the array such that:
\( \sum_{i \in S} A_i = \frac{1}{2} \sum_{i=1}^{n} A_i \)
If the total sum is odd, the partition is impossible. Otherwise, check if a subset with sum equal to half of the total sum exists.
inputFormat
The first line contains a single integer \(n\), representing the number of elements in the array. The second line contains \(n\) space-separated positive integers, representing the elements of the array.
outputFormat
Output a single line with either "True" if the array can be partitioned into two subsets of equal sum, or "False" otherwise.
## sample4
1 5 11 5
True