values and an integer groups. Can all the numbers be distributed into exactly groups non-empty groups so that every group has the same sum?
Each number goes into exactly one group. Return True or False.values=[6, 2, 4, 3, 3, 5, 1], groups=3 → True
The sum is 24, so each group needs 8: {6, 2}, {4, 3, 1}, {3, 5}.
values=[5, 5, 2], groups=2 → False
The sum is 12, so each group needs 6, but nothing can top up a 5 to exactly 6.
values=[7, 7, 7], groups=3 → True
values=[6, 2, 4, 3, 3, 5, 1], groups=3
True
Run checks the first 3 tests in your browser. Submit checks all 88 tests on the server, hidden ones included.