Minimum Number of Groups to Create a Valid Assignment
Each value's count must split into groups of size s or s+1; try group sizes from the smallest count down.
Each value's count must split into groups of size s or s+1; try group sizes from the smallest count down.