## Data structure and algorithm-1. Longest palindrome substring

1. Longest palindrome substring subject Give you a string s and find the longest palindrome substring in S. Example 1: Enter: s = "bad" Output: "bab" Explanation: "aba" is also the answer to the question. Example 2: Input: s = "cbbd" Output: "bb" Example 3: Input: s = "a" Outpu ...

Posted by fierdor on Sat, 23 Oct 2021 13:43:35 +0200

## Codeforces 1312E. Array Shrinking (interval DP stack)

linkkk Meaning: Give a length of n n The sequence of n for the same two adjacent numbers x x x can be replaced by a number x + ...

Posted by Nexy on Tue, 19 Oct 2021 23:28:07 +0200

## Summary of Dynamic Planning Backpack Classes

1. Fiborachi thinking (1) dp[i] Fibolacci number i, I is the number I I (2) Recursive formula dp[i]=dp[i-1]+dp[i+1] 3. Initialize the first two 0 and 1 (4) Traversal order is from front to back Examples The problem here is that the value is too large and requires redundancy of 1000000007. class Solution { public int fib(int n) { ...

Posted by shinichi_nguyen on Sat, 16 Oct 2021 18:13:47 +0200

## Dynamic programming (DP) algorithm problem 1

Problem description and status definition Digital triangle problem. There is a triangle composed of non negative integers. There is only one number in the first row. Except for the lowest row, there are one number at the lower left and right of each number, as shown in the figure. Starting from the number in the first line, you can go dow ...

Posted by ReDucTor on Sun, 10 Oct 2021 09:34:08 +0200

## Dynamic programming, backtracking and greedy algorithm to solve the change problem (minimum number of sheets payment problem) (JavaScript Implementation)

1. Background requirements: We have three kinds of coins with different denominations, 11 yuan, 5 yuan and 1 yuan (there must be). We have to pay 15 yuan (integer). How many coins do we need at least? At least 3 coins (3 5 yuan coins). 2. Realization of dynamic programming This problem should be fully suitable for dynamic programming ...

Posted by kousalya on Thu, 30 Sep 2021 19:54:50 +0200

## Record some questions asked to write in the interview and other favorite questions: the longest palindrome substring + the longest substring without repeated characters + the longest common substring

1. Question 5 of the longest palindrome substring force deduction Substring: substring must be continuous, which is different from the concept of subsequence Subsequence: Where the violent solution can be optimized: palindromes are judged only when the length of the substring is > the current maximum length, Is there anything that can be ...

Posted by bmyster on Tue, 21 Sep 2021 11:14:33 +0200