最长上升公共子序列(Longest Increasing Common Subsequence,LICS)也是经典DP问题,是LCS与LIS的混合。Problem求数列 a[1..n], b[1..m]的LICS的长度, a[], b[]数组的元素均为正整数。Solution考虑如何定义DP状态,定...
分类:
其他好文 时间:
2015-08-20 01:04:36
阅读次数:
159
${wjcd.lrsj}原来得到的是如2006-11-12 11:22:22.0${fn:substring(wjcd.lrsj, 0, 16)}使用functions函数来获取list的长度${fn:length(list)}fn:contains(string,substring) 假如參数s....
分类:
其他好文 时间:
2015-08-19 19:22:13
阅读次数:
117
背景
最近开始研究算法,于是在leetcode上做算法题,第五题Longest Palindromic Substring便是关于回文子串的。
什么是回文子串
回文字符串是指将该字符串前后颠倒之后和该字符串一样的字符串。例如:a,aaaa,aba,abba…
最长回文子串
要求最长回文子串,就需要遍历每一个子串,...
分类:
编程语言 时间:
2015-08-19 16:57:00
阅读次数:
171
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2015-08-19 13:14:00
阅读次数:
134
1 题目
Given a string,find the length of the longest substring without repeating characters. Forexample, the longest substring without repeating letters for"abcabcbb" is "abc", which the length is 3. F...
分类:
其他好文 时间:
2015-08-19 11:14:04
阅读次数:
167
题目地址:UVA 10100
题意:求两组字符串中最大的按顺序出现的相同单词数目。
思路:将字串中的连续的字母认作一个单词,依次计算出两个字符串中的单词,其中第1个字符串的单词序列为t1.word[1]…..t1.word[n],第2个字符串的单词序列为t2.word[1]…..t2.word[m]。然后将每个单词当成一个字符,使用LCS算法计算出两个字符串的最长公共子序列,该序列的长度就是最长...
分类:
其他好文 时间:
2015-08-18 21:30:39
阅读次数:
118
func?SubString(str?string,?begin,?end?int)?string?{
rs?:=?[]rune(str)
length?:=?len(rs)
if?begin?<?0?{
begin?=?0
}
if?begin?>=?length?{
return?""
}
if?end?>?len...
分类:
其他好文 时间:
2015-08-18 19:51:41
阅读次数:
96
String.IndexOfString.IndexOf 方法 (Char, Int32, Int32)报告指定字符在此实例中的第一个匹配项的索引。搜索从指定字符位置开始,并检查指定数量的字符位置。String.IndexOf(value, startIndex, count)参数value:要查找...
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-08-18 18:02:56
阅读次数:
198
(1)subString是否始终返回一个新串? 事实并非如此,subString只有在截取的子串是真子串(真子串指子串与原串不相同)时才会返回一个新声明的子串。当截取的是整个字符串时,则返回自身,具体可参考源码: subString方法用来截取子串,方法的使用有两种形式String subStr.....
分类:
其他好文 时间:
2015-08-18 16:09:03
阅读次数:
111