avoid solving same subproblems What is Dynamic Programming “Dynamic Programming was basically a phrase made up to confuse the government about what RAND was doing.” - Richard Bellman, ‘father’ of dynamic programming
all other problems, the key is to recognize common patterns Continuous practice is critical - you’re probably not going to master dynamic programming in 2 weeks. Why is Dynamic Programming so difficult?
n, return the number of ways to make change for the target amount n Given: {1, 5}, n = 6 Return: 2 { {6 x 1}, {5 x 1, 1 x 1} } Number of Ways to Make Change
Given: {1, 5}, n = 6 In each box, we’ll see how many ways we can make ’n’ with our coins 1, 5 Number of Ways to Make Change 0 1 2 3 4 5 6 1 1 1 1 1 2 2
Given: {1, 5}, n = 6 Let’s build up our array one ‘coin’ at a time (one pass with 1, second pass with 5) Number of Ways to Make Change 0 1 2 3 4 5 6 1 1 1 1 1 2 2
an array to store solutions to ‘subproblems’ - what would be the solution up to ‘this’ point? - Use stored solutions to populate future elements of the array
an array to store solutions to ‘subproblems’ - what would be the solution up to ‘this’ point? - Use stored solutions to populate future elements of the array - writing out the arrray and populating it by hand often helps you come up with the algorithm later
half does the other problem - 30 minutes, everybody tries to do their own problem - 10 minutes - group 1 explains their problem - 10 minutes - group 2 explains their problem - Last 10 minutes - everybody talks about the last problem and brainstorm what the dp array would look like
team figure out what to work on in the next 3-6 months? - How does the team tackle tech debt? - What is a typical release process? - Weekly? Biweekly? - How does the team prepare for releases? - How is the release monitored afterwards? - Are there oncall schedules?