[HackerRank][Python3] The Coin Change Problem
2018. 5. 15. 00:32 |
프로그래밍/HackerRank
Problem :
https://www.hackerrank.com/challenges/coin-change/problem
My Solution :
#!/usr/bin/env python3
def getWays(n, c):
dp = [1 if x == 0 else 0 for x in range(n + 1)]
for coin in c:
for i in range(coin, n + 1):
dp[i] += dp[i - coin]
return dp[n]
n, m = map(int, input().strip().split())
c = map(int, input().strip().split())
print(getWays(n, c))
'프로그래밍 > HackerRank' 카테고리의 다른 글
| [HackerRank][Python3] Big Sorting (0) | 2018.05.29 |
|---|---|
| [HackerRank][Python3] CamelCase (0) | 2018.05.27 |
| [HackerRank][Python3] Journey to the Moon (0) | 2018.05.25 |
| [HackerRank][Python3] Hackerland Radio Transmitters (0) | 2018.05.23 |
| [HackerRank][Python3] Sherlock and Cost (0) | 2018.05.21 |
| [HackerRank][Python3] Maximum Subarray Sum (0) | 2018.05.18 |
| [HackerRank][Python3] Equal (0) | 2018.05.16 |
| [HackerRank][Python3] Super Reduced String (2) | 2018.05.11 |
최근에 달린 댓글 최근에 달린 댓글