String DP summary

preface: Most question types of string DP use the minimum or maximum number of operation steps to change the original string into a new string. Therefore, most of them use interval DP to solve, and some of them will be optimized by interval DP. Below are some common question types. 1, Palindrome string multi-dimensional deformation 1. Fi ...

Posted by Fredric on Fri, 04 Feb 2022 09:37:42 +0100

Algorithm design and analysis tree dp

summary Premise of use: if the goal of problem solving is rule S, the solving process can be determined as each answer of the subtree with each node as the head node under rule S, and the final answer must be in itRoutine steps: (1) In the subtree with a node x as the head node, analyze the possibilities (difficulties) of the answer, and t ...

Posted by ramma03 on Fri, 04 Feb 2022 06:12:49 +0100

Codeforces Round #769 (Div. 2) A -D

https://codeforces.com/contest/1632 A If there is a palindrome substring in a string whose length is greater than 1, NO is output; otherwise, YES is outputViolence can be done, but there is a better idea. Note that this is a 01 string. If the length is greater than 2, there must be such a palindrome string, because both 001 and 010 meet this ...

Posted by vMan on Thu, 03 Feb 2022 07:28:24 +0100

MEX Sequences (state machine DP)

MEX Sequences [Link](Problem - D - Codeforces) meaning of the title Give you a sequence x n x_n xn, how many subsequences do you satisfy ∣ x ...

Posted by Stressed on Thu, 03 Feb 2022 07:04:39 +0100

Thinking analysis of dynamic programming problem in algorithmic interview

I wish you all good health and happiness in the new year. According to the observation and experience in the past decades, congratulations alone can't make people rich. Only when we successfully find a good job and win a satisfactory career can we have the opportunity to make money. Being able to enter a good enterprise is naturally a reasonabl ...

Posted by bluns on Wed, 02 Feb 2022 20:09:27 +0100

Fundamentals of dynamic programming

In fact, there are not many types of topics in dynamic programming. Here we only talk about simple DP, and the division boundary between various DP is not so obvious, so it is only a general division. It is important to learn to think. Dynamic programming I understand: excellent state representation + no weight and no leakage state transfer ...

Posted by freakstyle on Wed, 02 Feb 2022 01:51:51 +0100

Rookie brush question (14) [01 knapsack question]

[01 knapsack problem] There are # N items and a backpack with a capacity of # V. Each item can only be used once. The volume of the # i # article is # vi and the value is # wi. Solve which items are loaded into the backpack, so that the total volume of these items does not exceed the backpack capacity, and the total value is the largest. Out ...

Posted by xgrewellx on Mon, 31 Jan 2022 11:56:13 +0100

LeetCode132. Segmented palindrome string II - string dynamic programming

Topic overview Title Link: Ask me to do the problem Problem solution 1, General dynamic programming    in that sentence, the dynamic programming of string class can consider the state of the response problem of the first i characters, such as this problem and definition f ...

Posted by fred_belanger on Sun, 30 Jan 2022 23:46:04 +0100

Regular expression matching algorithm for problem solving

Title Description This topic comes from Force buckle , the difficulty is: difficulty, the title is described as follows: Give you a string s and a character rule p, please implement a support '.' Matches the regular expression of '*'. ‘.’ Match any single character'*' matches zero or more preceding elements The so-called mat ...

Posted by jkeppens on Sun, 30 Jan 2022 21:59:01 +0100

LeetCode1449. The sum of digit cost is the maximum number of target value (rethink the maximum sum in dynamic rules)

1449. The sum of digital costs is the maximum number of target values One question per day on June 12, 2021 Title Description Give you an array of integers cost And an integer target . Please return the maximum integer that can be obtained by satisfying the following rules: Add a digit to the current result( i + 1)The cost of is cost[i] (co ...

Posted by Defibber on Sun, 30 Jan 2022 20:10:55 +0100