this is my work function:
def array_sums_statistics_poss(arr, num):
if num == 0:
return True
elif len(arr) == 0:
return False
elif num < 0:
return False
else:
option1 = array_sums_statistics_poss(arr[:-1], num - arr[-1])
option2 = array_sums_statistics_poss(arr[:-1], num)
return option1 or option2
I want it to return a list
that looks like this [*True/False*, *X*]
, First element is a bool
for if there is a sub-sum list for num, Second element is an int
for numbers of calls, 0 if there isn't any!
example: print(array_sums_statistics_poss([7, 6, 18, 20], 14)) ------> [False, 23]