题目 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the ...
分类:
其他好文 时间:
2017-04-23 13:21:42
阅读次数:
164
方法:与substring的不同是这里不需要子串连续 或者 ...
分类:
其他好文 时间:
2017-04-23 01:01:41
阅读次数:
160
最简单的可以采用暴力解法,时间复杂度O(n^3),但时间会溢出 方法:使用动态规划的方法 方法二:采用向两边扩展的方法 ...
分类:
其他好文 时间:
2017-04-22 22:56:24
阅读次数:
204
题意:求最长递增子序列 AC代码:#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int dp[1010],a[1010]; int main() { int i,j,n; scanf("%d ...
分类:
其他好文 时间:
2017-04-21 21:31:08
阅读次数:
135
?????????(二) C++容器所谓序列式容器,其中的元素都可序(ordered),但未必有序(sorted)。数组为C++语言内置的序列容器,STL另外提供vector、list、deque(double-ended queue)。它们的差别在于访问元素的方式,以及添加或删除元素相关操作的运行... ...
分类:
数据库 时间:
2017-04-21 00:29:19
阅读次数:
187
最长上升子序列 一个数的序列 a i ,当 a 1 < a 2 < # < a N 时,称这个序列是上升的。对于给定的一个序列 ( a 1 , a 2 ,# , a N ),可以得到一些上升子序列( a i1 , a i 2 ,# , a iK ),这里 1 ≤ i1 < i 2 < # < iK ...
分类:
其他好文 时间:
2017-04-21 00:05:24
阅读次数:
211
题目:求两组字符串中最大的按顺序出现的同样单词数目。 分析: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] }; ...
分类:
其他好文 时间:
2017-04-17 15:47:56
阅读次数:
166
题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the ...
分类:
其他好文 时间:
2017-04-16 14:50:58
阅读次数:
105
Write a function to find the longest common prefix string amongst an array of strings.public class Solution { public string LongestCommonPrefix(string... ...
分类:
编程语言 时间:
2017-04-16 00:18:03
阅读次数:
197
Arrayss work well for unordered sequences, and even for ordered squences if they don't change much. But if you want to maintain an ordered list that a ...
分类:
其他好文 时间:
2017-04-15 21:54:05
阅读次数:
231