Welcome back coder to yet another question, "Tug of War". So be mindful while
going through this article, it is quite an easy problem.
We want you to go through the problem link to understand the outline of this question.
- You are given an array of n integers.
- You have to divide these n integers into 2 subsets such that the difference of sum of two subsets is minimum.
- If n is even, both sets will contain exactly n/2 elements. If n is odd, one set will contain (n-1)/2 and the other set will contain (n+1)/2 elements.
- If it is not possible to divide, then print "-1". We understand this question by taking [a, b, c, d] as the input array.