There are n
(n < 1000
) groups of friends, with the size of the group being characterized by an array A[]
(2 <= A[i] < 1000
). Tables are present such that they can accommodate r(r>2)
people at a time. What is the minimum number of tables needed for seating everyone, subject to the constraint that for every person there should be another person from his/her group sitting at his/her table.
The approach I was thinking was to break every group into sizes of twos and threes and try to solve this problem, but there are many ways of dividing a number n
into groups of twos and threes and not all of them may be optimal.