From 1e236469d4aa5990cdd1cbf44f586c7aa279b007 Mon Sep 17 00:00:00 2001 From: hulksmash20 <61261654+hulksmash20@users.noreply.github.com> Date: Sat, 3 Oct 2020 17:52:14 +0530 Subject: [PATCH] Create The_coin_change_problem.py --- .../dynamic_programming/The_coin_change_problem.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 algorithms/dynamic_programming/The_coin_change_problem.py diff --git a/algorithms/dynamic_programming/The_coin_change_problem.py b/algorithms/dynamic_programming/The_coin_change_problem.py new file mode 100644 index 0000000..d5bf9e9 --- /dev/null +++ b/algorithms/dynamic_programming/The_coin_change_problem.py @@ -0,0 +1,11 @@ +a,n=map(int,input().split()) +q=list(map(int,input().split())) +l=[1] +q=sorted(q) +for i in range(0,a): + l.append(0) +for coin in q: + for amount in range(1,a+1): + if amount>=coin: + l[amount]=l[amount-coin]+l[amount] +print(l[-1])