题目:求两组字符串中最大的按顺序出现的相同单词数目。
分析: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
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
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
1.具有相同core id的cpu是同一个core的超线程。(Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthr...
分类:
编程语言 时间:
2014-10-22 17:24:31
阅读次数:
286
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
Encode a string by counting the consecutive letter. (i.e., "aaaabbxxxyyz" might become "a4b2x3y2z1"). 分析: 这个问题是一个基本的数据压缩算法,将相邻的字符计数存储。解法没有什么特别需要注意的地方,...
分类:
Web程序 时间:
2014-10-21 19:17:38
阅读次数:
153
题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...
分类:
其他好文 时间:
2014-10-20 21:11:05
阅读次数:
203
Longest Ordered SubsequenceTime Limit: 2000msMemory Limit: 65536KBThis problem will be judged onPKU. Original ID:253364-bit integer IO format:%lld Jav...
分类:
其他好文 时间:
2014-10-20 11:28:21
阅读次数:
174
Language:
Default
Longest Ordered Subsequence
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 33986
Accepted: 14892
Description
A numeric sequence of a...
分类:
其他好文 时间:
2014-10-19 11:38:30
阅读次数:
249