Given an array of positive integers representing coin denominations and a single non-negative integer representing a target amount of money, implement a function that returns the number of ways to make change for that target amount using the given coin denominations. Note that an unlimited amount of coins is at your disposal.
Sample input: 6, [1, 5]
Sample output: 2 (1x1 + 1x5 and 6x1)
We can use a Stack here
Check this Python code.