Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
编程语言 时间:
2015-04-23 23:22:16
阅读次数:
203
题目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 “()”, which h...
分类:
其他好文 时间:
2015-04-23 21:49:15
阅读次数:
156
题目:Write a function to find the longest common prefix string amongst an array of strings.
翻译:求一个字符串数组中 共同的最长前缀。
思路:以第一个串为基准,逐个位置遍历,并遍历字符串数组,如果出现某个字符串长度小于当前位置,或者出现当前位置的字符不相同,返回字串strs[0].substring(0,p...
分类:
其他好文 时间:
2015-04-23 11:05:31
阅读次数:
108
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-04-22 07:04:07
阅读次数:
126
find the longest of the shortestTime Limit: 1000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2094Accepted Submi...
分类:
编程语言 时间:
2015-04-21 17:50:44
阅读次数:
177
problem:
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.
Hide Tags
Tr...
分类:
其他好文 时间:
2015-04-21 11:20:10
阅读次数:
108
题意:输出最长递增子序列的长度思路:直接裸LIS,
#include
const int N = 1001;
int a[N], f[N], d[N]; // d[i]用于记录a[0...i]的最大长度
int bsearch(const int *f, int size, const int &a) {
int l=0, r=size-1;
while( l <= r ){...
分类:
其他好文 时间:
2015-04-20 17:03:26
阅读次数:
156
题目:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exa...
分类:
其他好文 时间:
2015-04-20 13:12:01
阅读次数:
155
经典问题,可以把周边都做了,详见ref http://blog.csdn.net/linhuanmars/article/details/19949159public class Solution { public int lengthOfLongestSubstring(String s) ...
分类:
其他好文 时间:
2015-04-20 13:07:35
阅读次数:
115
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-04-19 15:49:13
阅读次数:
98