Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
                            
                            
                                分类:
其他好文   时间:
2015-01-23 18:12:03   
                                阅读次数:
171
                             
                    
                        
                            
                            
                                题目描述:Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example,...
                            
                            
                                分类:
其他好文   时间:
2015-01-23 16:15:18   
                                阅读次数:
131
                             
                    
                        
                            
                            
                                Problem C
Longest Run on a Snowboard
Input: standard input
Output: standard output
Time Limit: 5 seconds
Memory Limit: 32 MB
 
Michael likes snowboarding. That's not very surprising, since snow...
                            
                            
                                分类:
其他好文   时间:
2015-01-23 14:43:53   
                                阅读次数:
111
                             
                    
                        
                            
                            
                                原题地址方法I:动态规划len[i]表示从i开始到结束的最长合法括号串长度,则:如果s[i] == "(" 且 s[i+len[i+1]+1]==")",len[i] = len[i+1] + 2否则len[i] = 0方法II:辅助栈跟那个直方图求最大面积有点类似,用一个栈保存合法括号串的长度,显...
                            
                            
                                分类:
其他好文   时间:
2015-01-23 06:10:15   
                                阅读次数:
138
                             
                    
                        
                            
                            
                                题意,一颗树,每个边有个值,在树上找一条简单路径,使得这条路径上的边权异或值最大
把这题模型转换一下, 对于任意一条路径的异或,表示为f(u, v)
则f(u, v) = f(1, u) ^ f(1, v)
这是显然的
其中f(1, i)是可以再O(n)内处理出来
然后就是在一个数组内,找两个数异或值最大
然后就可以用字典树来搞
每个数变成01串,  然后插入字典树,...
                            
                            
                                分类:
其他好文   时间:
2015-01-22 23:24:23   
                                阅读次数:
192
                             
                    
                        
                            
                            
                                https://oj.leetcode.com/problems/longest-palindromic-substring/Given a stringS, find the longest palindromic substring inS. You may assume that the ma...
                            
                            
                                分类:
其他好文   时间:
2015-01-22 17:24:11   
                                阅读次数:
105
                             
                    
                        
                            
                            
                                Given a string, find the length of the longest substring T that contains at most 2 distinct characters.For example, Given s = “eceba”,T is "ece" which...
                            
                            
                                分类:
其他好文   时间:
2015-01-22 14:52:17   
                                阅读次数:
134
                             
                    
                        
                            
                            
                                Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes...
                            
                            
                                分类:
其他好文   时间:
2015-01-22 00:10:52   
                                阅读次数:
142
                             
                    
                        
                            
                            
                                use strict包含3个部分。其中之一(use strict "subs")负责禁止乱用的裸字。这是什么意思呢?如果没有这个限制,下面的代码也可以打印出"hello"。my $x = hello;print "$x\n"; # hello这样使用不符合我们平常把字符串放在引号里的习惯,但是...
                            
                            
                                分类:
其他好文   时间:
2015-01-21 21:55:50   
                                阅读次数:
187
                             
                    
                        
                            
                            
                                原题地址1. 把所有元素都塞到集合里2. 遍历所有元素,对于每个元素,如果集合里没有,就算了,如果有的话,就向左向右拓展,找到最长的连续范围,同时在每次找的时候都把找到的删掉。这样做保证了同样的连续序列只会被遍历一次,从而保证时间复杂度。时间复杂度O(n)代码: 1 int longestConse...
                            
                            
                                分类:
其他好文   时间:
2015-01-20 17:29:55   
                                阅读次数:
126