http://www.spoj.com/problems/LCS2/ 题意: 求10个串的LCS 1、用第一个串建立后缀自动机 2、len[s] 表示状态s 所能代表的字符串的最大长度 mx[s] 表示状态s 在 当前匹配的串的最长匹配后缀长度 ans[s] 表示状态s 在所有串的最长匹配后缀长度 ...
分类:
其他好文 时间:
2018-03-08 22:03:39
阅读次数:
226
题目中文:没有重复字符的最长子串 题目难度:Medium 题目内容: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", ...
分类:
编程语言 时间:
2018-03-08 18:09:56
阅读次数:
141
问题链接 "Leetcode 516" 题目解析 求最长回文子序列。 解题思路 子序列和子串有区别的,子序列不需要连续,相对位置递增即可。 动态规划。对于任意字符串,如果头尾字符相同,那么字符串的最长回文子序列等于去掉首尾的字符串的最长回文子序列加上首尾;如果首尾字符不同,则最长子序列等于去掉头的字 ...
分类:
其他好文 时间:
2018-03-08 17:27:40
阅读次数:
122
首先,没有第二题,没有第二题的原因是,JavaScript中根本就没有那种数据结构,尽管我在playground里面调试出了正确的结果,但是也许是因为数据结构问题,最终没能让我通过。 所以我就抛弃第二题了。 Given a string, find the length of the longest ...
分类:
其他好文 时间:
2018-03-06 23:24:15
阅读次数:
221
http://www.spoj.com/problems/LCS/ 题意:求两个串的最长公共子串 用一个串建后缀自动机,另一个串在上面类似于fail树的方式跑 不匹配时到它的parent树上的父节点,相当于保留当前最长匹配后缀 ...
分类:
其他好文 时间:
2018-03-06 23:15:25
阅读次数:
217
An integer interval [a, b] (for integers a < b) is a set of all consecutive integers from a to b, including a and b. Find the minimum size of a set S ...
分类:
其他好文 时间:
2018-03-04 00:24:15
阅读次数:
381
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the lo ...
分类:
其他好文 时间:
2018-03-03 18:22:58
阅读次数:
153
Given two strings a and b of equal length, what's the longest string (s) that can be constructed such that it is a child of both? A string x is said t ...
分类:
其他好文 时间:
2018-03-03 15:35:42
阅读次数:
179
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2018-03-03 12:18:35
阅读次数:
129
Write a function to find the longest common prefix string amongst an array of strings. 这题有好几种解法,个人认为会1,2的解法就可以了,但这种多方法解题的思路可以好好学习一下。具体可参考:Longest Comm ...
分类:
其他好文 时间:
2018-03-03 10:57:30
阅读次数:
178