In an American football game, a play can lead to 2 points (safety), 3 points (field goal), or 7 points (touchdown, assuming the extra point). Many different combinations of 2, 3, and 7 point plays can make up a final score.
Write a program that takes a final score and scores for individual plays, and returns the number of combinations of plays that result in the final score.
I was able to come up with solution that has space complexity of O(sn), where n = # of scores, and s= final score.
Now, I'm trying to improve it to use only O(s). It is a straight-forward for permutation, but I have no clue on how to prevent duplicates for combinations with only O(s).