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 […]

23-24C++ (46)–String string+ getline(cin, s)+a.length()+a.substr(x, y)+a.find(b)+a.rfind(b)

1. Characters and strings 1. Character: a single character enclosed in single quotes, Such as ‘a’, ‘_’, the corresponding data type is char. 2. String: any number of characters enclosed in double quotes, Such as “abc”, “a”, “”, ” “, the corresponding data type is const char [], which can be stored in the string […]

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 […]

Algorithms and Data Structures (24) Optimal substructure principle and dp array traversal direction

Note: This article is only a personal summary of the labuladong dynamic programming framework. It is limited to learning and communication. The copyright belongs to the original author; This article is a revised version of the dynamic programming Q&A open in new window published two years ago. Based on my continuous learning summary and readers’ […]

[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 […]