238. Partition Equal Subset Sum
MediumKnapsack
Print YES if the array can be split into two subsets with equal sums, else NO.
Input format
Line 1: n Line 2: n positive integers
Output format
YES or NO
Example 1
Input
4 1 5 11 5
Output
YES
Example 2
Input
4 1 2 3 5
Output
NO
Constraints
1 ≤ n ≤ 200 1 ≤ values ≤ 100
Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.
Loading the MyLoginn IDE…