Problem. Given positive integers nums, return whether they can be split into two subsets with equal sums.
nums = [1, 5, 11, 5] → True ({1, 5, 5} and {11}: both 11)
nums = [1, 2, 3, 5] → False (total 11 is odd)
If the total is odd, no. Otherwise the question is: does some subset sum to total / 2? (The rest automatically sums to the other half.) That's the subset-sum problem, the simplest 0/1 knapsack: each item is used at most once, and the DP state is "which sums are reachable".
ML context. Splitting work into equal halves: assigning data shards (with different numbers of tokens) to two GPUs so both finish together, splitting a dataset into two halves of equal size by whole groups (so no group straddles the split), balancing two pipeline stages by layer costs (lesson 5.8 for k stages). When an exact split isn't possible, the smallest difference (Change A) is what you want.