blob: b9ddf1d5d17913b2d0d14ad068e23c90b3378b52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
import sys
def min_coins(coins, m, V):
if (V == 0):
return 0
res = sys.maxsize
for i in range(0, m):
if (coins[i] <= V):
sub_res = min_coins(coins, m, V-coins[i])
if (sub_res != sys.maxsize and sub_res + 1 < res):
res = sub_res + 1
return res
|