weights. Can all of them be split into two piles with the same total mass?
Every weight must go into exactly one pile. Return True if this is possible and False otherwise.weights=[3, 8, 2, 7] → True
The total weight is 20: the piles {3, 7} and {8, 2} weigh 10 each.
weights=[6, 1, 1, 2] → False
The total is 10, yet any pile holding the 6 is already over 5, and without it the most you can gather is 4.
weights=[5, 4] → False
weights=[3, 8, 2, 7]
True
Run checks the first 3 tests in your browser. Submit checks all 69 tests on the server, hidden ones included.