题目:求两组字符串中最大的按顺序出现的相同单词数目。
分析:dp,最大公共子序列(LCS)。把单词整个看成一个元素比较即可。
状态:f(i,j)为s1串前i个单词与s2串前j个单词的最大匹配数;
转移:f(i,j)= max(f(i-1,j),f(i,j-1)){ s1[i] ≠ s2[j] };
...
分类:
其他好文 时间:
2014-10-23 16:17:30
阅读次数:
183
序言:在不知道jsoup框架前,由于项目需求,需要定时抓取其他网站上的内容,便想到用HttpClient方式获取指定网站的内容,这种方法比较笨,就是通过url请求指定网站,根据指定网站返回文本解析。说白了HttpClient充当一下浏览器的角色,返回的文本需要自己处理,一般都是用string.indexOf或者string.subString方法处理。
当有一天发现jsoup这个...
分类:
Web程序 时间:
2014-10-23 00:11:44
阅读次数:
181
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2014-10-22 23:32:51
阅读次数:
235
给出的是一个字符串数组,然后去求这些字符串的最长公共前缀,挺有意思的一道题目。public class Solution { public String longestCommonPrefix(String[] strs) { if (strs.length==0||strs[0...
分类:
其他好文 时间:
2014-10-22 23:32:33
阅读次数:
270
Js的substring和C#的Substring的作用都是从一个字符串中截取出一个子字符串,但它们的用法却有非常大的不同,下边我们来比較看看:Js的substring语法:程序代码String.substring(start, end)说明:返回一个从start開始到end(不包括end)的子字符...
分类:
Web程序 时间:
2014-10-22 20:06:28
阅读次数:
200
一、生成GUID的方法一JScript 代码 复制function guid() { function S4() { return (((1+Math.random())*0x10000)|0).toString(16).substring(1); } return (...
分类:
编程语言 时间:
2014-10-22 19:51:39
阅读次数:
204
Write a function to find the longest common prefix string amongst an array of strings. 1 class Solution { 2 public: 3 string longestCommonPrefix(v...
分类:
其他好文 时间:
2014-10-22 17:30:53
阅读次数:
228
problem:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a con...
分类:
其他好文 时间:
2014-10-22 00:47:47
阅读次数:
203
题目:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concaten...
分类:
其他好文 时间:
2014-10-22 00:29:15
阅读次数:
189
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 lea...
分类:
其他好文 时间:
2014-10-21 22:58:39
阅读次数:
235