How to solve the coin problem with the skill of golang browsing leetcode
Editor to share with you golang leetcode tips on how to solve the coin problem, I hope you will learn something after reading this article, let's discuss it together!
Coins. Given an unlimited number of coins with a value of 25 cents, 10 cents, 5 cents and 1 cent, there are several expressions for coding to calculate n points. (the result may be very large, you need to model the result by 1000000007)
Example 1:
Input: n = 5
Output: 2
Explanation: there are two ways to add up the total amount:
Five, five.
5 "1" 1 "1" 1
Example 2:
Input: n = 10
Output: 4
Explanation: there are four ways to add up the total amount:
10: 10
10 years 5 years 5 years
10 "5" 1 "1" 1 "1" 1
10 "1" 1 "1" 1 "1" 1 "1" 1
Description:
Note:
You can assume:
0