#C7214. Equal Sum Partition
Equal Sum Partition
Equal Sum Partition
Given a list of integers, determine whether you can partition the list into exactly two non-empty subsets such that the sum of the elements in both subsets is the same.
This problem can be mathematically formulated as finding a subset with sum equal to \(\frac{1}{2}\sum_{i=1}^{n} a_i\), where \(a_i\) represents the elements of the array and \(n\) is the number of elements. If \(\sum_{i=1}^{n} a_i\) is odd, then such a partition is impossible. You are expected to solve this problem using a dynamic programming approach.
inputFormat
The input is given via standard input (stdin). The first line contains an integer (n) representing the number of elements. The second line contains (n) space-separated integers.
outputFormat
Output via standard output (stdout) a single line containing either "True" if such a partition exists or "False" otherwise.## sample
4
1 5 11 5
True