def solution(concentrations, target):
answer = 0
def dfs(start, cnt, total):
nonlocal answer
if cnt == 4:
if total == target:
answer += 1
return
for i in range(start, len(concentrations)):
dfs(i + 1, cnt + 1, total + concentrations[i])
dfs(0, 0, 0)
return answer
concentrations = [20, 20, 20, 20, 40, 40, 40, 40]
target = 120
print(solution(concentrations, target))
To embed this project on your website, copy the following code and paste it into your website's HTML: