1.

You are given infinite coins of N denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the time complexity of a dynamic programming implementation used to solve the coin change problem?(a) O(N)(b) O(S)(c) O(N^2)(d) O(S*N)The question was posed to me in a job interview.I would like to ask this question from Coin Change Problem topic in portion Dynamic Programming of Data Structures & Algorithms II

Answer»

(d) O(S*N)

The TIME COMPLEXITY is O(S*N).



Discussion

No Comment Found

Related InterviewSolutions