Divide numbers into fewest groups with each group's sum bounded We have an integer $K$ and an array of $N$ positive integers each smaller than $K$. How do we group the numbers into the minimum number of groups where the sum of each group is less than or equal to $K$?
As comments suggested it is called the Bin Packing Problem.