#include #include #include using namespace std ; int coinChange(vector &coins, int n, int target) { if(target == 0) { return 1; } if(target < 0) { return 0; } if(n <= 0 && target > 0) { return 0; } return coinChange(coins, n - 1, target) + coinChange(coins, n, target - coins[n - 1] ); } int numberOfCombinations(vector &coins, int target) { int n = coins.size(); return coinChange(coins, n, target); } int main() { std::vector v1 ; v1.push_back( 1 ) ; v1.push_back( 2 ) ; cout << numberOfCombinations(v1, 4 ) << endl ; return 1 ; }