Your question is Sum to Target From Array. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Medbridge can use this validation logic when checking whether available course credits can exactly satisfy a requested total. Given an array of nonnegative integers and a nonnegative target, determine whether some subset of the array sums exactly to the target.
Each array element may be used at most once, and you may choose any number of elements, including none. Return True if such a subset exists, otherwise return False.
Implement can_form_sum(nums, target), where nums is a list of integers and target is an integer. The function must return a Boolean.
def can_form_sum(nums, target):