Problems > Exact Subset Sum > Editorial

Exact Subset Sum — Solution & Editorial

Back to the Problem

Boolean knapsack: reachable[v] |= reachable[v − x] processing each item once (iterate v downward, or use a bitset shift — one machine word op per 64 sums).

Complexity: O(N·T / 64) with bitsets