hdu 1003 最大连续子串
#include <bits/stdc++.h>#define PI acos(-1.0)#define mem(a,b) memset((a),b,sizeof(a))#define TS printf("!!!\n")#define pb push_back//std::ios::s...
[LeetCode] Longest Substring Without Repeating Characters 最长无重复字符的子串
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3Explanation: The answer is "...
[LeetCode] Longest Substring Without Repeating Characters最长无重复子串
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
【LeetCode】3.Longest Substring Without Repeating Characters 最长无重复子串
题目:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the len...
LeetCode Longest Substring Without Repeating Characters 最长不重复子串
题意:给一字符串,求一个子串的长度,该子串满足所有字符都不重复。字符可能包含标点之类的,不仅仅是字母。按ASCII码算,就有2^8=128个。思路:从左到右扫每个字符,判断该字符距离上一次出现的距离是多少,若大于max,则更新max。若小于,则不更新。每扫到一个字符就需要更新他的出现位置了。这里边还...
[LeetCode] Longest Substring Without Repeating Characters 最长无重复字符的子串 C++实现java实现
最长无重复字符的子串Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3Explanation: The a...
003 Longest Substring Without Repeating Characters 最长不重复子串
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length...
[LeetCode] 3.Longest Substring Without Repeating Characters 最长无重复子串
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3Explanation: The answer is "...
Manacher's algorithm: 最长回文子串算法
Manacher 算法是时间、空间复杂度都为 O(n) 的解决 Longest palindromic substring(最长回文子串)的算法。回文串是中心对称的串,比如 'abcba'、'abccba'。那么最长回文子串顾名思义,就是求一个序列中的子串中,最长的回文串。本文最后用 Python ...
Manacher 求最长回文子串算法
Manacher算法,是由一个叫Manacher的人在1975年发明的,可以在$O(n)$的时间复杂度里求出一个字符串中的最长回文子串。例如这两个回文串“level”、“noon”,Manacher算法先对其进行一个处理:level --> #l#e#v#e#l#noon --&...
[hdu3068 最长回文]Manacher算法,O(N)求最长回文子串
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3068题意:求一个字符串的最长回文子串思路:枚举子串的两个端点,根据回文串的定义来判断其是否是回文串并更新答案,复杂度O(N3)。枚举回文串的对称轴i,以及回文半径r,由i和r可确定一个子串,然后暴力判断...
SPOJ - DISUBSTR 多少个不同的子串
694. Distinct SubstringsProblem code: DISUBSTRGiven a string, we need to find the total number of its distinct substrings.InputT- number of test cases...
Girls' research---hdu3294(回文子串manacher)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3294给出一个字符串和加密的字符规律例如 c abcbac代表把串中的c改成a,d改成b... b改成z,a改成y...即上串是yzazy,然后求出它的最长回文子串, 并记录子串的开始下标和结束下标就行了...
51Nod 1753 相似子串
题目大意:两个字符串相似定义为:1.两个字符串长度相等2.两个字符串对应位置上有且仅有至多一个位置所对应的字符不相同给定一个字符串,每次询问两个子串在给定的规则下是否相似。给定的规则指每次给出一些等价关系,如‘a'=’b',‘b'=’c'等,注意这里的等价关系具有传递性,即若‘a'=’b',‘b'=...
【NOIP2015提高组】子串
https://daniu.luogu.org/problem/show?pid=2679看到方案数问题直觉就能想到DP,考虑用f(i,j,k)表示A[1...i]取k个子串组成B[1...j]的方案数,发现很难转移,因为不知道之前的方案哪些是还能拼接到结尾的,产生了前效性。考虑加一维,即A[1.....
【TOJ 2406】Power Strings(KMP找最多重复子串)
描述Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of conca...
BZOJ3230: 相似子串
3230: 相似子串Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 913 Solved: 223[Submit][Status]DescriptionInput输入第1行,包含3个整数N,Q。Q代表询问组数。第2行是字符串S。接下来Q行,每行两个整...
SPOJ694 -- DISUBSTR 后缀树组求不相同的子串的个数
DISUBSTR - Distinct Substrings Given a string, we need to find the total number of its distinct substrings.InputT- number of test cases. T<=20;Each...
【Java】 子字符串的比较(substring的==与equal()使用)
public class Test {public static void main(String[] args) { String str1="good"; System.out.println(str1=="good"); System.out.println(str1.equ...
【BZOJ-1396&2865】识别子串&字符串识别 后缀自动机/后缀树组 + 线段树
1396: 识别子串Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 312 Solved: 193[Submit][Status][Discuss]DescriptionInput一行,一个由小写字母组成的字符串S,长度不超过10^5OutputL行...