Skip equal repeats
transcript
Two coupons are equal. Swapping them changes nothing. Count each bundle once. Sort, then skip.
Coupons: one, one, two. By position, eight subsets. But only six different bundles. Two are repeats of others. Sorting puts equal values side by side.
Sort the values first. At one level, try each value once. Skip an equal repeat at that level. Never skip at a deeper level.
Skipping at the same level finds six. Skipping at any index finds four. It loses the bundle one, one. The test is i greater than start.
Count the copies of each value. Choose a value, not a coupon. Then no repeat can arise. Pickup orders use this idea too.
Track the running total. At the end, test the modulus. Count the bundle if it fits. The empty bundle has total zero.
Sort the values. Skip at the same level. Count each bundle once. Full breakdown in the lecture.