mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-23 09:38:27 +00:00
Update minimum_coin_change.py
Add some input and output examples on top
This commit is contained in:
parent
8112c055eb
commit
0bbf0ea76e
@ -1,7 +1,45 @@
|
|||||||
import sys
|
import sys
|
||||||
from doctest import testmod
|
from doctest import testmod
|
||||||
|
"""
|
||||||
|
Test cases:
|
||||||
|
Do you want to enter your denominations ? (Y/N) :N
|
||||||
|
Enter the change you want to make in Indian Currency: 987
|
||||||
|
Following is minimal change for 987 :
|
||||||
|
500 100 100 100 100 50 20 10 5 2
|
||||||
|
|
||||||
|
Do you want to enter your denominations ? (Y/N) :Y
|
||||||
|
Enter number of denomination:10
|
||||||
|
1
|
||||||
|
5
|
||||||
|
10
|
||||||
|
20
|
||||||
|
50
|
||||||
|
100
|
||||||
|
200
|
||||||
|
500
|
||||||
|
1000
|
||||||
|
2000
|
||||||
|
Enter the change you want to make: 18745
|
||||||
|
Following is minimal change for 18745 :
|
||||||
|
2000 2000 2000 2000 2000 2000 2000 2000 2000 500 200 20 20 5
|
||||||
|
|
||||||
|
Do you want to enter your denominations ? (Y/N) :N
|
||||||
|
Enter the change you want to make: 0
|
||||||
|
The total value cannot be zero or negative.
|
||||||
|
Do you want to enter your denominations ? (Y/N) :N
|
||||||
|
Enter the change you want to make: -98
|
||||||
|
The total value cannot be zero or negative.
|
||||||
|
Do you want to enter your denominations ? (Y/N) :Y
|
||||||
|
Enter number of denomination:5
|
||||||
|
1
|
||||||
|
5
|
||||||
|
100
|
||||||
|
500
|
||||||
|
1000
|
||||||
|
Enter the change you want to make: 456
|
||||||
|
Following is minimal change for 456 :
|
||||||
|
100 100 100 100 5 5 5 5 5 5 5 5 5 5 5 1
|
||||||
|
"""
|
||||||
def find_minimum_change(denominations: list[int], value: int) -> list[int]:
|
def find_minimum_change(denominations: list[int], value: int) -> list[int]:
|
||||||
"""
|
"""
|
||||||
Find the minimum change from the given denominations and value.
|
Find the minimum change from the given denominations and value.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user