#2910
Minimum Number of Groups to Create a Valid Assignment
expert · 1190 · lc medium +32 · 24.8% accepted · 395 likes · top 4%
Description
A collection of numbered balls must be distributed into boxes with these rules:
- All balls sharing a box must have the same numeric value; balls with the same number may go into different boxes.
- The largest box may contain at most one more ball than the smallest box.
Return the minimum number of boxes required.
Code
1
2
3