Use recursion to check all possible combinations of coins to find the minimum number of coins needed to create the given sum. Update the number of coins needed with each iteration.
Solve the problem by breaking it down into smaller subproblems and using a bottom-up approach to compute dp[i] (1<=i<=subproblems) which stores the minimum number of coins needed to create the sum.