1.

You are given infinite coins of 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. This problem can be solved using ____________(a) Greedy algorithm(b) Dynamic programming(c) Divide and conquer(d) BacktrackingThis question was addressed to me by my school principal while I was bunking the class.Query is from Coin Change Problem in chapter Dynamic Programming of Data Structures & Algorithms II

Answer»

The correct option is (b) Dynamic programming

Best EXPLANATION: The coin change PROBLEM has OVERLAPPING subproblems(same subproblems are solved multiple TIMES) and optimal substructure(the solution to the problem can be found by finding optimal solutions for subproblems). So, dynamic programming can be used to solve the coin change problem.



Discussion

No Comment Found

Related InterviewSolutions