Which problems can be solved by dynamic programming?
How many ways to get to the lower right cornerHow many ways to choose k numbers so that Sum is Sum Find the maximum and minimum value
The maximum number and number of paths from the upper left corner to the lower right cornerLongest rising sequence length Seeking existence
Added by cybernet on Fri, 17 Sep 2021 17:24:29 +0300
Question surface: Valley portal
Algorithm elements: tarjan + tree dp
1, General summary
It can be found that the points in a ring must be selected at the same time, so it is easy to think of tarjan shrinking points. After shrinking, a DAG is formed. Due to the condition of the subject, d[i]=0 means that one software does not ...
Added by magicmoose on Fri, 17 Sep 2021 13:54:45 +0300
Suppose you have an array in which\ i i The first element is the stock in the second\ i i Day price.
You have a chance to buy and sell. You can't sell a stock until you buy it. Please design an algorithm to calculate the maximum benefit.
Added by deane034 on Tue, 14 Sep 2021 08:20:41 +0300
Three characteristics of dynamic planning:
Dynamic Planning Solutions:
1. State Transition Table Method
2.State Transfer Equation Method
3.1 LeetCode 509.Fibonacci Number
3.2 LeetCode 70.Climb stairs
3.3 LeetCode 198.Raid homes and plunder houses
3.4 LeetCode 53.Maximum Subordinate Sum
3.5 LeetCode 152.Pro ...
Added by mentalfloss on Fri, 10 Sep 2021 08:19:02 +0300
Count class dp
Given the scheme limit, count the number of occurrences of a certain scheme
Original question link
General idea of the topic
A positive integer n can be expressed as the sum of several positive integers, such as: n=n1+n2 +... + nk, where n1 ≥ n2 ≥... ≥ nk,k ≥ 1 ...
Added by tpc on Sat, 04 Sep 2021 00:06:03 +0300
123. Best time to buy and sell stocks III
Given an array, its first element is the price of a given stock on day i.
Design an algorithm to calculate the maximum profit you can make.You can complete up to two transactions.
**Note: ** You cannot participate in multiple transactions at the same time (you must sell your previous shares before bu ...
Added by lj11 on Thu, 02 Sep 2021 22:08:29 +0300