← All tools

Subset Sum Solver

Given a set of non-negative integers and a target, find subsets that sum exactly to the target. The classic subset sum problem — decide whether a solution exists, count how many subsets hit the target, reconstruct one, or enumerate all of them (capped). Dynamic programming over the target sum. Everything runs locally in your browser.

Inputs

Numbers
Target sum

Result

The subset sum problem asks whether some subset of a given set of non-negative integers sums exactly to a target — a classic NP-complete decision problem. This tool solves it with dynamic programming over 0..target: dp[w] counts how many subsets of the items processed so far sum to w, scanning w downward so each item is used at most once (0/1). Decision reports whether dp[target] > 0; Count reports dp[target]; One and All use a suffix-reachability table to reconstruct solutions (items are distinct by position, so duplicate values yield distinct subsets). The empty subset counts for target 0 unless disabled. Enumeration is capped to keep the page responsive, with the true total shown. Distinct from the Knapsack Solver, which maximizes value under a weight cap rather than hitting an exact sum. Pairs with the Knapsack Solver and Partition tools. Everything runs locally — nothing leaves your browser.