码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
LeetCode 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 leaf node. 题意:求树的高度。 思路:就是递归。 /** * Definiti...
分类:其他好文   时间:2015-05-01 12:06:48    阅读次数:163
(字符串)最长公共字串(Longest-Common-SubString,LCS)
题目:给定两个字符串X,Y,求二者最长的公共子串,例如X=[aaaba],Y=[abaa]。二者的最长公共子串为[aba],长度为3。子序列是不要求连续的,字串必须是连续的。思路与代码:1、简单思想:遍历两个字符串X、Y,分别比较X的字串与Y的字串,求出最长的公共字串。设X长度为m,Y长度为n,最长...
分类:其他好文   时间:2015-05-01 11:58:58    阅读次数:179
(字符串)最长公共字串(Longest-Common-SubString,LCS)
题目:给定两个字符串X,Y,求二者最长的公共子串,例如X=[aaaba],Y=[abaa]。二者的最长公共子串为[aba],长度为3。子序列是不要求连续的,字串必须是连续的。思路:1、简单思想:遍历两个字符串X、Y,分别比较X的字串与Y的字串,求出最长的公共字串。#include #include ...
分类:其他好文   时间:2015-04-30 19:57:51    阅读次数:125
(字符串)最长公共子序列(Longest-Common-Subsequence,LCS)
问题:最长公共子序列就是寻找两个给定序列的子序列,该子序列在两个序列中以相同的顺序出现,但是不必要是连续的。例如序列X=ABCBDAB,Y=BDCABA。序列BCA是X和Y的一个公共子序列,但是不是X和Y的最长公共子序列,子序列BCBA是X和Y的一个LCS,序列BDAB也是。思路:1、最简单的方法就...
分类:其他好文   时间:2015-04-30 17:54:16    阅读次数:103
LeetCode 3 -- 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 fo...
分类:其他好文   时间:2015-04-30 15:36:25    阅读次数:135
LCS(最长公共子序列)和dp(动态规划)
参照:v_JULY_v        最长公共子序列定义:         注意最长公共子串(Longest CommonSubstring)和最长公共子序列(LongestCommon Subsequence, LCS)的区别:子串(Substring)是串的一个连续的部分,子序列(Subsequence)则是从不改变序列的顺序,而从序列中去掉任意的元素而获得的新序列;更简略地说,前者(子串...
分类:其他好文   时间:2015-04-30 14:23:18    阅读次数:146
[LeetCode] Binary Tree Right Side View
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example: Given the following binary tree, 1...
分类:其他好文   时间:2015-04-30 14:17:56    阅读次数:118
[Leetcode] Longest Consecutive Sequence 略详细 (Java)
题目参见这里https://leetcode.com/problems/longest-consecutive-sequence/这个题目我感觉很难,看了半天别人写的答案,才明白个所以然。下面的代码是我自己的改编,写的好像很复杂的样子,主要也是为了方便自己理解,耐着性子看完,应该就理解了。【个人分析...
分类:编程语言   时间:2015-04-30 10:25:48    阅读次数:113
[目录][Leetcode] Leetcode 题解索引
之前想边做题边写结题报告,发现有点力不从心,而且很多地方也是一知半解,现在重新做题,重新理解。这篇文章主要起一个目录的作用。128 Longest Consecutive Sequence (Java) [Hard] [Array]
分类:其他好文   时间:2015-04-30 10:16:14    阅读次数:110
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-04-30 06:19:30    阅读次数:117
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!