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
经典问题,可以把周边都做了,详见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
总结帖http://blog.csdn.net/linhuanmars/article/details/39366817code 参考帖http://www.cnblogs.com/springfor/p/3869981.htmlhttp://blog.csdn.net/linhuanmars/ar...
分类:
其他好文 时间:
2015-04-19 12:54:10
阅读次数:
120
Write a function to find the longest common prefix string amongst an array of strings.思路:这道题其实很简单。只不过一开始我就想复杂了,一看求Longest,就联想到DP。然后又联想到Set来求交并。后来,突然想到...
分类:
其他好文 时间:
2015-04-19 12:54:06
阅读次数:
121
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-04-18 23:29:41
阅读次数:
123
题意:在一堆无序元素中找到最长的连续串的长度,要求时间复杂度O(N)
思路:首先将元素放到set集合中,然后再判断,每次判断是否包含某元素的复杂度为O(1)
代码:
public int longestConsecutive(int[] num) {
int currLen = 0, longestLen = Integer.MIN_VALUE;
Se...
分类:
其他好文 时间:
2015-04-18 10:09:13
阅读次数:
88