Arts is an activity initiated by Chen Hao (online name Left Ear Mouse) in his Geek Time column, aiming to keep learning through sharing.

Each week, I will write an Arts: Algorithm, Review an English article, Technique/Tips, Share a small Technique and Share an idea.

This week the content


This week’s algorithm question is the DP entry question: Leetcode 322 Change Change.

It should be one of the most common problems in dynamic programming, the specific solution can be from the recursive way. That is, assume that the minimum number of gold coins required to raise the total amount of I is dp[I]. Dp [I] = min(dp[i-coina], dp[i-coinb]…) Base case can be defined as DP [0] = 0. Base case can be defined as DP [0] = 0. Here’s the code:

Func coinChange(coins []int, amount int) int {// dp[I] = min(dp[i-coina], dp[i-coinb], dp[i-coinb], dp[i-coinb], ...). +1 dp := make([]int, amount+1) dp[0] = 0 // Initialize amount+1 = 0 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 Distributed systems learning classic material, or is a Distributed systems introduction learning outline: Distributed Systems Theory for the Distributed Systems Engineer.

For the design idea of the distributed system, the paper gives a super multi theory + practice learning materials. It includes some ebooks for beginners, explanations of core concepts such as CAP theory, and finally some software projects worth referring to. The article is not long, but the information given is very substantial. It will take at least two or three months to read it. Most likely, reviews in the next few weeks will come from the information given in this article.

TIP Programming Tips

This week’s programming is no trick.

Share had a flash of inspiration

It’s been a week without a spark.