码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果)
104. Maximum Depth of Binary Tree
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 l ...
分类:其他好文   时间:2016-04-20 21:35:38    阅读次数:146
Longest Substring Without Repeating Characters
题意为给出一个字符串,找出其中没有重复字符的最长子序列的长度。brute force的复杂度为O(n^3).依次查找每个子字符串是否含有重复字符,并比较长度。开始看到题目,想用DP解决,在已有目前最长子序列的情况下,比较把当前字符串放入和不放入,那个子序列长度会更大,但是这种解法的复杂度为O(n^2 ...
分类:其他好文   时间:2016-04-19 00:09:11    阅读次数:127
[LeetCode]-011-Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. []=>""["abcweed","htgdabc","sabcrf"]=>""["abcweed","abhtgdc","a ...
分类:其他好文   时间:2016-04-18 11:38:56    阅读次数:129
第三章算法作业(求助攻)
3-1.LIS(longest increas sequence)不多说,题目说了要($ O(n^2) $),我还能说什么呢? 相同题目:HDU 1087 super jumping !jumping!jumping! 而且不卡平方的做法 用dp[i]表示以 i 个数结尾的序列的LIS长度,初始化为 ...
分类:编程语言   时间:2016-04-18 10:12:54    阅读次数:284
Longest Common Subsequence (DP)
Given two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. Example For "ABCD" and "EDCA", the LCS is "A" ...
分类:其他好文   时间:2016-04-18 08:43:52    阅读次数:117
leetcode-Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:其他好文   时间:2016-04-17 11:37:10    阅读次数:158
14. Longest Common Prefix
...
分类:其他好文   时间:2016-04-16 01:59:14    阅读次数:179
Longest Substring without Repeating Characters
刷leetcode,看到一个算法,给大神跪了。。。。看了半天才明白,下面谈谈理解 这道题最朴素的想法,就是两层遍历: 1、第一层遍历所有字符,表示以每一位置的字符打头的子串; 2、第二层,以某一位置字符开头,向后遍历,可以用map容器插入操作判断是否有重复字符,并计算长度; 3、这样做的话,实际上是 ...
分类:其他好文   时间:2016-04-15 21:54:33    阅读次数:233
14. Longest Common Prefix (截取字符串)
Write a function to find the longest common prefix string amongst an array of strings. ...
分类:其他好文   时间:2016-04-13 20:22:35    阅读次数:229
HackerRank "Larry's Array"
I caught the sparkle in my mind and got AC1 ! It is a great great experience ! So the basic idea: permute on 3 consecutive items doesn't change the pa ...
分类:其他好文   时间:2016-04-13 07:11:01    阅读次数:274
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!