Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the roo ...
分类:
其他好文 时间:
2019-01-05 00:16:27
阅读次数:
164
$SAM$上匹配 我们就是需要找到两个串的最长公共子串 先对其中一个串建出$SAM$,之后我们把另一个串放到上面跑 如果当前在$SAM$的状态是$now$,下一个字符是$c$,匹配出的的长度为$L$ 如果$now$有$c$这个转移,我们就转移过去,$L$++ 如果没有我们就跳$link$,知道跳到有 ...
分类:
其他好文 时间:
2019-01-03 22:41:36
阅读次数:
179
Let's say we have two strings: str1 = 'ACDEB' str2 = 'AEBC' We need to find the longest common subsequence, which in this case should be 'AEB'. Using ...
分类:
其他好文 时间:
2019-01-01 23:51:59
阅读次数:
161
Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer ...
分类:
其他好文 时间:
2019-01-01 11:15:59
阅读次数:
117
Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer ...
分类:
其他好文 时间:
2019-01-01 11:07:51
阅读次数:
169
"【SPOJ】Longest Common Substring II" 多个字符串求最长公共子串 还是将一个子串建SAM,其他字符串全部跑一边,记录每个点的最大贡献 由于是所有串,要对每个点每个字符串跑完后去最小值才是每个点的最终贡献 cpp include include include incl ...
分类:
其他好文 时间:
2018-12-31 13:04:01
阅读次数:
188
题目如下: Return all non-negative integers of length N such that the absolute difference between every two consecutive digits is K. Note that every number ...
分类:
其他好文 时间:
2018-12-31 11:54:37
阅读次数:
213
题目描述 给定一个包含$n$个整数的序列$a$,$0\le a_i \le 10^6$,询问不重复数字个数$\le k$的最长区间的左右端点。如果有多解输出任意一组。 输入输出格式 输入格式: The first line contains two integers $n,k$ ( $1 \leq ...
分类:
其他好文 时间:
2018-12-31 10:26:30
阅读次数:
215
"【SPOJ】Longest Common Substring" 求两个字符串的最长公共子串 对一个串建好后缀自动机然后暴力跑一下 ~~废话~~ 讲一下怎么跑吧 从第一个字符开始遍历,遍历不到了再沿着$parents$走看能否找到出路,走到某个点时,统计一下走过了多少点然后更新答案 来说说这样做的正 ...
分类:
其他好文 时间:
2018-12-30 22:18:45
阅读次数:
165
Return all non-negative integers of length N such that the absolute difference between every two consecutive digits is K. Note that every number in th ...
分类:
其他好文 时间:
2018-12-30 18:47:55
阅读次数:
164