You can exempt atmost one element from the set to acheive the goal. example:-
N=3
the numbers given are = 1,2,5
So,
Set 1 should be :- [1]
Set 2 should be :- [2]
We have excluded 5 as we can acheive a lesser difference without it being in either groups.
N=4
numbers = 1,2,2,5
Set1 = [1,2,2]
Set2 = [5]
What is best algorithm for this? I know that this a NP-complete problem. And I think that brute force would give me the correct solution but I need an algorithm if available.