Finishing combo sequences
In a fighting game, each attack in your move list deals a fixed amount of damage, and you may repeat attacks freely. A finishing combo must deal exactly the boss's remaining health — no overkill. Given the list of distinct positive damage values and the boss health, return how many distinct ordered sequences of attacks deal exactly that total. The same attacks in a different order count as different combos. If health is 0, return 1 (the empty combo).
Implement
count_finishing_combos(damages: list[int], health: int) → intExamples
in
[[1,2],4]out5in
[[2,3],7]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 14 min
solution.py
InputExpectedGot
[[1,2],4]5not run yetsample[[2,3],7]3not run yetsample