Relative Content

Tag Archive for calgorithmmaxgrouping

Find the maximum group that satisfied a condition

Suppose I have an array of numbers {1,2,3,4,5,6,7,8,9} The maximum group that the sum of the members is bigger or equal 6 is 5
Group 1: 9
Group 2: 8
Group 3: 7
Group 4: 6
Group 5: 5, 1
Group 6: 4, 2
We don’t need to use all the member of an array. I not sure what is the best algorithm for this problem?