Classic example
Input
nums = [3, 34, 4, 12, 5, 2], target = 9
Output
True
Subset {4,5} sums to 9.
Full lesson preview
Determine whether any subset of numbers sums exactly to a target using dynamic programming.
Problem statement
Task
Examples
Input
nums = [3, 34, 4, 12, 5, 2], target = 9
Output
True
Subset {4,5} sums to 9.
Input format
Output format
Constraints
Samples
Input
subset_sum([], 0)
Output
True
Empty subset sums to 0.