Recurrence and variations of strstr function (calculating the number of substrings)

1.Introduction to strstr #include<string.h> char* strstr(const char* str1,const char* str2); Input the array name of the parent string and the array name of the substring. The function will return a pointer of type char*. This pointer points to the address of the first element of the first substring in the parent string. So how do […]

Find the longest repeating substring in a string—-Finding feature vector N method

Article directory topic Question analysis Implementation details Functions and their functions Use parameters and specific functions getmax_N(string P,int* N): Next(string P) main() Program running results Supplement (code explanation of feature vector N) Title Write an algorithm to return the longest repeating substring and its subscript position for a given string str. eg: str=”abcdacdac”, then the […]

The road to growth if you want to become proficient in algorithms and SQL – the longest substring with at least K repeating characters

The road to growth if you want to master algorithms and SQL – the longest substring with at least K repeating characters Preface 1. The longest substring with at least K repeating characters 1.1 The premise of sliding window: two-stage nature 1.2 Manually add restrictions to make them two-stage 1.3 Complete code (sliding window) 1.4 […]

Longest Palindromic substring

What is a palindrome string? That is, the forward reading and reverse reading are the same strings. For example, strings like aba, abba, and cdc are all palindrome strings. Brute force method to find the longest palindrome substring What this diagram means is that we need to get each number on the right and then […]

CS144 (2023 Spring) Lab 1: stitching substrings into a byte stream

Article directory Preface Other notes Related Links 1. Getting started 2. Putting substrings in sequence 2.1 Requirements analysis 2.2 Things to note 2.3 Code implementation 3. Testing and Optimization Foreword This Lab mainly implements the string reception and reassembly part of a TCP receiver. Other notes Lab 0: networking warmup Lab 1: stitching substrings into […]

2023-08-18: Write algorithms in go. You will get a string text, you should split it into k substrings (subtext1, subtext2, …, subtextk). Requirements met: subtexti yes

2023-08-18: Write algorithms in go. you will get a string text, You should split it into k substrings (subtext1, subtext2, …, subtextk). Requirements meet: subtexti is a non-empty string, concatenation of all substrings equals text , (i.e. subtext1 + subtext2 + … + subtextk == text), subtexti == subtextk – i + 1 means all […]

[Dynamic Programming] Topic on Palindromic Substrings

Article directory 1. 【LeetCode】647. Palindrome substring 1.1 Idea explanation 1.1.1 Method selection 1.1.2 Creation of dp table 1.1.3 State transition equation 1.1.4 Order of filling out the form 1.2 Overall code 2. 【LeetCode】5. The longest palindrome string 2.1 Idea explanation 2.2 Code implementation 3.【LeetCode】094. Split Palindrome II 3.1 Problem-solving ideas 3.1.1 Create dp table 3.1.2 […]

Specific use of MySQL segmentation function substring()

Directory 1. LEFT() function Two, RIGHT () function Three, SUBSTRING () function Four, SUBSTRING_INDEX () function 5. Practical operation MySQL string interception functions mainly include: left(), right(), substring(), substring_index(). Each has its usage scenarios. Today, let me take you a few minutes to familiarize yourself with them, Mark! One, LEFT() function LEFT(string,length) , starting from […]

Sliding window technique to solve substring problem

1. Code framework Implemented using hash table + double pointer; The double pointer refers to the left and right border pointers of the user maintenance sliding window; /* Sliding window algorithm framework */ void slidingWindow(String s) {<!– –> // Record the data in the window with the appropriate data structure HashMap<Character, Integer> window = new […]