Time：2022-5-24

# ARTS

Arts is an activity initiated by Chen Hao (online name left ear mouse) in the geek time column. The purpose is to keep learning through sharing.

Write an arts every week: algorithm is an algorithm problem, review is to read an English article, technology / tips is to share a small technology, and share is to share a point of view.

## Algorithm

This week’s algorithm is DP introduction: leetcode 322 change

It should be one of the most common problems in dynamic programming. The specific solution ideas can be solved in a recursive way That is, assume that the minimum number of gold coins required to round up the total amount of I is DP [i] that`dp[i] = min(dp[i-coinA], dp[i-coinB], ...) + 1`And then to the idea of DP, the above equation is a recursive formula, and base case can be defined as DP  = 0 Here is the code:

``````func coinChange(coins []int, amount int) int {
//DP [i] represents the minimum number of coins required when the total amount is I
// dp[i] = min(dp[i-coinA], dp[i-coinB], ...) + 1
dp := make([]int, amount+1)
dp = 0
//Initializing to amount + 1 is equivalent to setting the initial value to infinity, because only amount coins are required for the total amount
for i := 1; i < amount+1; i++ {
dp[i] = amount+1
}

for i := 1; i <= amount; i++ {
for _, c := range coins {
if i < c {
continue
}
dp[i] = min(dp[i], dp[i-c]+1)
}
}
if dp[amount] == amount+1 {
return -1
}
return dp[amount]
}

func min(a, b int) int {
if a < b {
return a
}
return b
}``````

## Review article recommendation

This week’s article is a classic material for distributed systems learning, or an introductory learning outline for distributed systems: distributed systems theory for the distributed systems engineer

For the design idea of distributed system, this paper gives the learning materials of super multi theory + practice It includes some e-books for novices, some core concepts such as the explanation of cap theory, and finally gives some software projects worthy of reference The article is not long, but the information given is very substantial. It will take at least two or three months to read it High probability that the review in the next few weeks will come from the information given in this article

## Tip programming skills

This week’s programming has no skills at all