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-07-22 23:16:14
阅读次数:
408
题目: Given a string, find the length of the longest
substring without repeating characters. For example, the longest substring
without repeating letter...
分类:
其他好文 时间:
2014-04-30 21:15:32
阅读次数:
511
String Test "); //返回第一个字符 out.println("1-8个字符:" +
str.substring(1, 10) + "");//获得字串 out.println("p为结尾...
分类:
其他好文 时间:
2014-04-30 14:27:14
阅读次数:
343
有时候,即使高度被设置为100%,也只是页面的100%,如果某个表格突然很长,则其他的层的高度跟不上。从body的100%开始,就跟不上最长的那个div。没有想到更好的解决方法。现在的解决方法是:用jquery获取最长的层的高度.height()。再给其他的层设置这个最大高度。注:jquery的wi...
分类:
其他好文 时间:
2014-04-29 23:02:35
阅读次数:
514
Problem description:given a string, find the
longest palindrome string in itSolution:1.brute force O(n^3)just enumerate start
and end of the substring...
分类:
其他好文 时间:
2014-04-29 17:22:46
阅读次数:
308
m(i,v) = max{m(i-1,v),m(i-1,v-vi) + wi } ,v > vi
分类:
其他好文 时间:
2014-04-29 14:59:56
阅读次数:
599
这道题中要求时间复杂度为O(n),首先我们可以知道的是,如果先对数组排序再计算其最长连续序列的时间复杂度是O(nlogn),所以不能用排序的方法。我一开始想是不是应该用动态规划来解,发现其并不符合动态规划的特征。最后采用类似于LRU_Cache中出现的数据结构(集快速查询和顺序遍历两大优点于一身)来...
分类:
其他好文 时间:
2014-04-28 10:21:19
阅读次数:
1003