Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try to generate all pairs of subsets and check which group provides maximal strength.
It can also be solved in O(NlogN) by sorting the array and using all positive integers.
Use negative integers only in pairs such that their product becomes positive.