题目
    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....
                            
                            
                                分类:
其他好文   时间:
2014-10-25 18:50:01   
                                阅读次数:
137
                             
                         
                    
                        
                            
                            
                                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...
                            
                            
                                分类:
其他好文   时间:
2014-10-25 07:04:13   
                                阅读次数:
208
                             
                         
                    
                        
                            
                            
                                Write a function to find the longest common prefix string amongst an array of strings.题目言简意赅,貌似也不难,暴力法用一个char *数组存放strs里每个元素的起始地址,然后循环,同时把所有指针向前移动,如果有...
                            
                            
                                分类:
其他好文   时间:
2014-10-25 00:52:44   
                                阅读次数:
265
                             
                         
                    
                        
                            
                            
                                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 ...
                            
                            
                                分类:
其他好文   时间:
2014-10-24 23:30:05   
                                阅读次数:
260
                             
                         
                    
                        
                            
                            
                                题目描述:
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。
代码:
/**...
                            
                            
                                分类:
其他好文   时间:
2014-10-24 13:04:21   
                                阅读次数:
147
                             
                         
                    
                        
                            
                            
                                题目:求两组字符串中最大的按顺序出现的相同单词数目。
分析: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
                             
                         
                    
                        
                            
                            
                                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