Deposit combinations
A savings app lets users schedule deposits only in fixed amounts — for example 1, 2, and 5 dollars — with unlimited uses of each. Given the list of distinct positive deposit amounts and a savings goal, return how many different combinations of deposits reach the goal exactly. Two combinations are the same if they use each amount the same number of times; order does not matter. A goal of 0 has exactly one combination: deposit nothing.
Implement
count_deposit_mixes(amounts: list[int], goal: int) → intExamples
in
[[1,2,5],5]out4in
[[2,3],12]out3What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 15 min
solution.py
InputExpectedGot
[[1,2,5],5]4not run yetsample[[2,3],12]3not run yetsample