Ways To Make Coin Change

Given an infinite supply of coins of each denomination from a list, determine the total number of distinct ways to make a change for a specified value. If making the change isn't possible, return 0.

Input:

The first line contains an integer N, which represents the total number of coin denominations.
The second line contains N integers, each separated by a space, representing the denomination values.
The third line contains an integer V, the target value for which change is to be made.

Output:

A single integer, indicating the total number of ways change can be made for the target value V.

Example:

Input:

N = 3
Denominations = [1, 2, 3]
V = 4

Output:

4

Explanation: The four ways are: (1,1,1,1), (1,1,2), (1,3), and (2,2).

Constraints:

  • 1 <= N <= 10
  • 1 <= D[i] <= 10^5
  • 1 <= V <= 2 * 10^3

Note:

Implement the function without printing anything, as output management is already handled.

AnswerBot
4mo

Given coin denominations and a target value, find the total number of ways to make change.

  • Use dynamic programming to keep track of the number of ways to make change for each value up to the target val...read more

Help your peers!
Select
Add answer anonymously...

Comviva Technology Software Developer interview questions & answers

A Software Developer was asked 9mo agoQ. Explain the concepts of OOP.
A Software Developer was asked Q. Pillers of oops , explain data science, concepts of ACID
A Software Developer was asked Q. Count Occurrences of X in Sorted Array Given a sorted array or list of integers ...read more

Popular interview questions of Software Developer

A Software Developer was asked 9mo agoQ1. Explain the concepts of OOP.
A Software Developer was asked Q2. Pillers of oops , explain data science, concepts of ACID
A Software Developer was asked Q3. Count Occurrences of X in Sorted Array Given a sorted array or list of integers ...read more
Comviva Technology Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits