summaryrefslogtreecommitdiff
path: root/progs/a844.py
blob: 069b713446b4f96205fb89ff05912e68898dc51c (plain)
1
2
3
4
5
6
7
8
def is_subset_sum(set, n, sum):
	if (sum == 0):
		return True
	if (n == 0):
		return False
	if (set[n - 1] > sum):
		return is_subset_sum(set, n - 1, sum)
	return is_subset_sum(set, n-1, sum) or is_subset_sum(set, n-1, sum-set[n-1])