#C12765. Partition Equal Subset Sum
Partition Equal Subset Sum
Partition Equal Subset Sum
Given an array of integers, determine whether it can be partitioned into two subsets such that the sum of the elements in both subsets is equal. In other words, check if there exists a subset \(S\) such that
\(\sum_{x \in S} x = \sum_{x \notin S} x\).
If such a partition exists, output True
; otherwise, output False
. Note that an empty array is considered partitionable into two empty subsets.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n) representing the number of elements. The second line contains (n) space-separated integers.
outputFormat
Print a single line to standard output (stdout) containing True
if the array can be partitioned into two subsets with equal sum, otherwise print False
.## sample
4
1 5 11 5
True
</p>