LCS Longest Common Substring Description 给两个长度$\le 250000$的小写字母串, 求最长公共子串. Solution 子串就是SAM了. 对其中一个建出SAM, 另一个在上面跑, 如果可以转移, 就直接转移, 长度加一, 否则跳父亲到可以转移, 自然 ...
分类:
其他好文 时间:
2018-11-22 00:31:01
阅读次数:
251
先看一下题目描述: 先默认strs[0]是最长公共前缀prefix,然后通过indexOf判断是prefix是否从strs[1]0索引开始,如果不是,则通过substring函数减少一位,直到从0索引开始。时间复杂度为O(N)。 ...
分类:
其他好文 时间:
2018-11-21 16:07:07
阅读次数:
204
1. Question: url : https://leetcode.com/problems/longest-continuous-increasing-subsequence/ 674. Longest Continuous Increasing Subsequence Given an un ...
分类:
其他好文 时间:
2018-11-19 22:09:44
阅读次数:
148
https://leetcode.com/problems/longest-palindromic-substring/ Given a string s, find the longest palindromic substring in s. You may assume that the ma ...
分类:
其他好文 时间:
2018-11-19 15:07:40
阅读次数:
186
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This ...
分类:
其他好文 时间:
2018-11-16 17:43:50
阅读次数:
116
https://leetcode.com/tag/union-find/ ...
分类:
其他好文 时间:
2018-11-15 17:07:47
阅读次数:
253
1.翻转字符串算法 1 function reverseString(str) { 2 var res=str.split("").reverse().join(""); 3 return res; 4 } 5 reverseString("hello"); 2.阶乘算法 1 function fa ...
分类:
编程语言 时间:
2018-11-15 00:08:48
阅读次数:
231
这道题主要是有三个变量。因为要确定一个substring,就有start point和end point,这组成了两个变量。然后其次,我们至少对每个substring从头到尾loop一遍,来确定这个substring是不是palindrome,这又需要一个n。所以,如果用暴力解法的话,这道题的tim ...
分类:
其他好文 时间:
2018-11-12 11:25:52
阅读次数:
126
1. 用1阶至4阶Newton-Cotes公式计算积分 程序: function I = NewtonCotes(f,a,b,type) % syms t; t=findsym(sym(f)); I=0; switch type case 1, I=((b-a)/2)*(subs(sym(f),t, ...
分类:
其他好文 时间:
2018-11-10 23:58:24
阅读次数:
683
git log --since="2017-03-01" --before="2019-12-10" --author="$(git config --get matengfei)" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += ...
分类:
其他好文 时间:
2018-11-10 17:59:43
阅读次数:
192