Tag:substring
-
[daily algorithm / brush through leetcode] 3 Longest substring without duplicate characters (medium)
Click here to view more content related to algorithmic interview~ Title Description Given a string, please find the length of the longest substring that does not contain duplicate characters. Example 1: Input: S = “abcabcbb” output: 3 Explanation: because the longest substring without repeated characters is “ABC”, its length is 3. Example 2: Input: S […]
-
【LeetCode】76. Minimum covering substring
76. Minimum string coverage Knowledge points: string; sliding window Title Description Give you a string s and a string t. Returns the smallest substring in s that covers t all characters. If there is no substring covering t all characters in s, the empty string “” is returned. be careful: For repeated characters in T, […]
-
2021.12.19 brush notes — sliding window series
The idea of window is that there is a window. When the conditions are met, change the size of the window. When the conditions are not met, move the left boundary of the window int[] check = new int[size]; //Left boundary int left =0; //Right boundary int right = 1; //The window has been initially […]
-
JS determines whether a string is included in the string
Method of string objectMethod 1: indexof () (recommended) var str = “123”; console.log(str.indexOf(“3”) != -1 ); // true The indexof () method returns the first occurrence of a specified string value in the string. If the string value to retrieve does not appear, the method returns – 1. Method 2: Search () var str = […]
-
[algorithm learning] – sliding window algorithm (JavaScript)
Sliding window algorithm: Literally, everyone has seen the window and can open and close the window ×)The window of the sliding window algorithm here is divided into fixed and unfixed. The fixed window is the kind of window seen in life. Imagine a large window, and then the sliding screen window. The screen window here […]
-
Leetcode-003 – longest substring without duplicate characters
Longest substring without duplicate characters Title Description: given a string, please find out the length of the longest substring that does not contain repeated characters. See leetcode’s official website for an example. Source: leetcodeLink: https://leetcode-cn.com/probl…The copyright belongs to Lingkou network. For commercial reprint, please contact the official authorization, and for non-commercial reprint, please indicate the […]
-
Leetcode-005-longest palindrome substring
Longest Palindromic Substring Title Description: give you a string s and find the longest palindrome substring in S. See leetcode’s official website for an example. Source: leetcodeLink: https://leetcode-cn.com/probl…The copyright belongs to Lingkou network. For commercial reprint, please contact the official authorization, and for non-commercial reprint, please indicate the source. Solution 1: violent cracking Traverse all […]
-
Java machine test question *: password interception (longest palindrome substring)
describe Catcher is an intelligence agent of MCA country. During his work, he found that enemy countries will communicate with some symmetrical passwords, such as Abba, ABA, a, 123321, but they sometimes add some irrelevant characters at the beginning or end to prevent other countries from cracking. For example, make the following changes: Abba – […]
-
[leetcode 32] longest valid bracket
Give you a string containing only ‘(‘ and ‘)’ and find the length of the longest valid (well formed and continuous) parenthesis substring. Brain circuits not awake: convert to + 1, – 1 sequence, and use two necessary and sufficient conditions (the sum of sub segments is 0, and the sum of any prefix of […]
-
Strings function commonly used by golang
Strings function commonly used by golang function brief introduction len(str) 1. Statistics string length, by byte len (STR) 2. String traversal, processing Chinese R: = [] run (STR) 3. String to integer n, err: = strconv Atoi(“12”) 4. Integer to string STR = strconv Itoa(12345) 5. String to [] byte var bytes = [] byte […]
-
strand
strand Basic concepts definition character string(string): a finite sequence of multiple or zero characters. String name:S String valueCharacter sequence in: ”. Length of string: number of characters in the string n. When n = 0Empty string。 Substring: a subsequence of any consecutive characters in a string Main string: string containing substrings. The position of the […]
-
The third and fourth questions of leetcode — the longest substring without repeated characters and finding the median of two positively ordered arrays
1. Leetcode question 3Requirements:https://leetcode-cn.com/probl… Given a string s, please find the length of the longest substring that does not contain duplicate characters.Input: S = “pwwkew”Output: 3Explanation: because the longest substring without repeated characters is “WKE”, its length is 3. Please note that your answer must be the length of the substring, “pwke” is a substring, not […]