码迷,mamicode.com
首页 >  
搜索关键字:longest    ( 2697个结果
[LeetCode] Maximum Depth of Binary Tree dfs,深度搜索
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 le...
分类:其他好文   时间:2015-01-08 20:06:49    阅读次数:131
LeetCode---Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo...
分类:其他好文   时间:2015-01-07 23:40:19    阅读次数:305
spoj 1811
1811. Longest Common SubstringProblem code: LCSA string is finite sequence of characters over a non-empty finite set Σ.In this problem, Σ is the set o...
分类:其他好文   时间:2015-01-07 23:22:12    阅读次数:154
[LeetCode]128 Longest Consecutive Sequence
https://oj.leetcode.com/problems/longest-consecutive-sequence/http://blog.csdn.net/linhuanmars/article/details/22964467publicclassSolution{ publicintlongestConsecutive(int[]num){ //SolutionA: //returnlongestConsecutive_Sort(num); //SolutionB: returnlonges..
分类:其他好文   时间:2015-01-07 19:03:11    阅读次数:165
最长上升子序列算法
这题目是经典的DP题目,也可叫作LIS(Longest Increasing Subsequence)最长上升子序列 或者 最长不下降子序列。很基础的题目,有两种算法,复杂度分别为O(n*logn)和O(n^2) 。A.O(n^2)算法分析如下:(a[1]...a[n] 存的都是输入的数)1、对于a...
分类:编程语言   时间:2015-01-07 18:26:49    阅读次数:280
java-Longest Consecutive Sequence
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 consecutive elements sequence is [1, 2,...
分类:编程语言   时间:2015-01-07 16:52:23    阅读次数:141
[Leetcode] 5 - Longest Palindromic Substring
题目链接:https://oj.leetcode.com/problems/longest-palindromic-substring/ 这道题通常可以写出来的是2种做法。 1. 保持一个index从前往后扫,每次index的循环中,保持left和right的index向两边扫,但是有2种情况,aba和abba。left和right的扫描要扫2次 2. DP做法,2维矩阵 * 可以...
分类:其他好文   时间:2015-01-07 15:00:44    阅读次数:128
【Leetcode】Longest Consecutive Sequence
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 consecutive elements sequence is [1, 2, 3...
分类:其他好文   时间:2015-01-07 10:58:06    阅读次数:191
leetcode 5.Longest Palindromic Substring
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:其他好文   时间:2015-01-06 23:07:00    阅读次数:208
LeetCode:Longest Common Prefix
题目描述: Write a function to find the longest common prefix string amongst an array of strings. 代码: string Solution::longestCommonPrefix(vector &strs) { string result = ""; if(strs.size(...
分类:其他好文   时间:2015-01-06 12:03:24    阅读次数:137
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!