码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
leetcode.5 Longest Palindromic Substring
问题描述: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Example 2: 思路: 根据 ...
分类:其他好文   时间:2018-05-26 10:44:49    阅读次数:162
Leetcode 128. Longest Consecutive Sequence (union find)
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Examp ...
分类:其他好文   时间:2018-05-23 13:07:29    阅读次数:303
LeetCode - Binary Tree Longest Consecutive Sequence
Recursion: 时间O(n) 空间O(h) 因为要找最长的连续路径,我们在遍历树的时候需要两个信息,一是目前连起来的路径有多长,二是目前路径的上一个节点的值。我们通过递归把这些信息代入,然后通过返回值返回一个最大的就行了。 ...
分类:其他好文   时间:2018-05-23 11:57:56    阅读次数:163
poj-3522 最小生成树
Description Given an undirected weighted graph G, you should find one of spanning trees specified as follows. The graph G is an ordered pair (V, E), w ...
分类:其他好文   时间:2018-05-23 00:11:33    阅读次数:206
128. Longest Consecutive Sequence
class Solution { public: int longestConsecutive(vector& nums) { unordered_set s(nums.begin(), nums.end()); int res = 0; while (!s.empty()) { int p = *... ...
分类:其他好文   时间:2018-05-20 15:33:11    阅读次数:151
【LeetCode算法】Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Exampl ...
分类:编程语言   时间:2018-05-19 17:02:12    阅读次数:177
673. Number of Longest Increasing Subsequence
[抄题]: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: 不知道为什么len[i] == len[j] + 1:因为可以间隔相加。 也不知道为什么是DP:原来小人是间隔着跳的。 [一句话思路]: [ ...
分类:其他好文   时间:2018-05-16 00:45:37    阅读次数:169
【TOJ 2176】Surprising Strings
描述 The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of its D-pairs ...
分类:其他好文   时间:2018-05-14 13:19:15    阅读次数:186
最长公共子串
题目描述 对于两个字符串,请设计一个时间复杂度为O(m*n)的算法(这里的m和n为两串的长度),求出两串的最长公共子串的长度。这里的最长公共子串的定义为两个序列U1,U2,..Un和V1,V2,...Vn,其中Ui + 1 == Ui+1,Vi + 1 == Vi+1,同时Ui == Vi。 给定两 ...
分类:其他好文   时间:2018-05-12 16:49:41    阅读次数:175
福建省赛--Problem E The Longest Straight(二分枚举)
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2216 题意:给你n张纸牌,代表的数字在1至m区间,给出k张joker可以充当任何牌,现在求出最大的连续区间的长度。 题目分析:枚举连续序列的起点,二分枚举二分序列的终点 ...
分类:其他好文   时间:2018-05-10 23:30:40    阅读次数:234
3212条   上一页 1 ... 72 73 74 75 76 ... 322 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!