Given non-negative integers, can you split them into two groups with equal sums?
Implement:
can_partition(nums)subset_with_sum(nums, target): a sorted list of indices whose values sum to target, or None. Any valid subset is fine.min_partition_difference(nums): the smallest possible |sum(A) - sum(B)| over all splits into two groupsUse the DP over reachable sums. A neat trick in Python: store the reachable set as the bits of one big integer, reach |= reach << x.