Three-way equal-sum partition dynamic programming
ID: three-way-equal-sum-partition-dynamic-programming
For positive integer weights of total , store reachable pairs of sums assigned to the first two groups after each input list prefix. The third sum is determined by the processed total minus . Assign each new occurrence to one of the three groups using a fresh layer; accept exactly final state . The transitions are sound by construction and complete by deleting the last occurrence from a valid assignment. The state range is , giving time and rolling space.
New to topics? Read the docs here!