问题:Given an array of N integer, find the length of the longest increasing subsequence.For example, given [1,-5,4,5,10,-1,-5,7], the longest increasing...
分类:
编程语言 时间:
2015-08-05 00:40:24
阅读次数:
154
问题描述Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given [100, 4, 200, 1, 3, 2],The lo...
分类:
其他好文 时间:
2015-08-04 12:46:55
阅读次数:
115
Given a sequence of integers S = {S1,S2,...,Sn}, you should determine what is the value of the maximum positive product involving consecutive terms...
分类:
其他好文 时间:
2015-08-02 21:21:49
阅读次数:
125
原题:Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the maximum positive product involving consecutive...
分类:
其他好文 时间:
2015-08-02 19:59:19
阅读次数:
100
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 leaf node.
思路:很基础的一个题,DFS即可。代码如下:
/**
* Defin...
分类:
其他好文 时间:
2015-08-01 22:08:25
阅读次数:
140
传送门十分重要的基础DP问题,是学习用各种方式优化DP的一个很好的例子。设DP[i]表示以a[i]结尾的LIS的长度,则状态转移方程为DP[1]=1DP[i] = max{DP[j], j1暴力求解复杂度为O(N^2)。优化1考虑函数f(L):长度为 L 的 Increasing Sequence ...
分类:
其他好文 时间:
2015-08-01 20:28:08
阅读次数:
90
题目:Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of themaximum positive product involving consecutive ...
分类:
其他好文 时间:
2015-08-01 15:39:01
阅读次数:
124
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()",
...
分类:
其他好文 时间:
2015-08-01 10:07:41
阅读次数:
107
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-07-31 16:08:47
阅读次数:
103
Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
求最长公共前缀。
代码如下:
class Solution {
public:
string longestCommonPrefix(vect...
分类:
其他好文 时间:
2015-07-30 19:28:27
阅读次数:
109