Write a function to find the longest common prefix string amongst an array of strings.
Solution:
class Solution 
{
public:
    string longestCommonPrefix(vector &strs) 
    {
        vector s = strs...
                            
                            
                                分类:
其他好文   时间:
2015-01-09 09:17:16   
                                阅读次数:
122
                             
                    
                        
                            
                            
                                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-01-08 20:06:49   
                                阅读次数:
131
                             
                    
                        
                            
                            
                                Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without
 repeating letters for "abcabcbb" is "abc", which the length is 3. Fo...
                            
                            
                                分类:
其他好文   时间:
2015-01-07 23:40:19   
                                阅读次数:
305
                             
                    
                        
                            
                            
                                1811. Longest Common SubstringProblem code: LCSA string is finite sequence of characters over a non-empty finite set Σ.In this problem, Σ is the set o...
                            
                            
                                分类:
其他好文   时间:
2015-01-07 23:22:12   
                                阅读次数:
154
                             
                    
                        
                            
                            
                                https://oj.leetcode.com/problems/longest-consecutive-sequence/http://blog.csdn.net/linhuanmars/article/details/22964467publicclassSolution{
publicintlongestConsecutive(int[]num){
//SolutionA:
//returnlongestConsecutive_Sort(num);
//SolutionB:
returnlonges..
                            
                            
                                分类:
其他好文   时间:
2015-01-07 19:03:11   
                                阅读次数:
165
                             
                    
                        
                            
                            
                                这题目是经典的DP题目,也可叫作LIS(Longest Increasing Subsequence)最长上升子序列 或者 最长不下降子序列。很基础的题目,有两种算法,复杂度分别为O(n*logn)和O(n^2) 。A.O(n^2)算法分析如下:(a[1]...a[n] 存的都是输入的数)1、对于a...
                            
                            
                                分类:
编程语言   时间:
2015-01-07 18:26:49   
                                阅读次数:
280
                             
                    
                        
                            
                            
                                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 longest consecutive elements sequence is [1,
 2,...
                            
                            
                                分类:
编程语言   时间:
2015-01-07 16:52:23   
                                阅读次数:
141
                             
                    
                        
                            
                            
                                题目链接:https://oj.leetcode.com/problems/longest-palindromic-substring/
这道题通常可以写出来的是2种做法。
1. 保持一个index从前往后扫,每次index的循环中,保持left和right的index向两边扫,但是有2种情况,aba和abba。left和right的扫描要扫2次
2. DP做法,2维矩阵
* 可以...
                            
                            
                                分类:
其他好文   时间:
2015-01-07 15:00:44   
                                阅读次数:
128
                             
                    
                        
                            
                            
                                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 longest consecutive elements sequence is [1, 2, 3...
                            
                            
                                分类:
其他好文   时间:
2015-01-07 10:58:06   
                                阅读次数:
191
                             
                    
                        
                            
                            
                                Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
                            
                            
                                分类:
其他好文   时间:
2015-01-06 23:07:00   
                                阅读次数:
208