Let's say I have a list of numbers:
2,2,3,4,4
Split the numbers into N groups (3 groups here as an example):
A:2,3 sum:5
B:4 sum:4
C:2,4 sum:6
What I want is to minimize (the group with the highest sum (6 here) - the group with the smallest sum (4 here))
Does anyone think of an algorithm to achieve this?
Another example:
7,7,8,8,8,9,9,10
The result should be as follows:
A:7,8,8 sum:23
B:7,8,9 sum:24
C:9,10 sum:19