Subset Sum Possible
Problem statement
You are given an integer array arr and an integer target. Return true if some subset of arr has sum exactly target; otherwise return false.
Each array element may be used at most once.
Function
isSubsetSum(arr: int[], target: int) → booleanExamples
Example 1
arr = [3,34,4,12,5,2]target = 9return = trueThe subset [4,5] sums to 9.
The source shared the rule but did not include this exact sample. FastPrep added this small example so the behavior can be checked directly.