码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果)
[leetcode]
问题描述: 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 [...
分类:其他好文   时间:2014-11-26 22:39:47    阅读次数:201
Manacher处理回文的方法
这里,我介绍一下O(n)回文串处理的一种方法。Manacher算法.原文地址:http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-palindrome-sub-...
分类:其他好文   时间:2014-11-26 18:38:27    阅读次数:167
[leetcode]Longest Substring with At Most Two Distinct Characters
很明显的2 pointer问题。。。当满足条件的时候后面的指针加,不满足条件的时候前面的指针加,直到满足条件。。。class Solution {public: int lengthOfLongestSubstringTwoDistinct(string s) { int sta...
分类:其他好文   时间:2014-11-26 16:10:45    阅读次数:336
[LeetCode] Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.思路:每个字符串都与第0个字符串比较,设置一个变量,记录每个字符串与第0个字符串不匹配位置的最小值 时间复杂度O(n1+n2.....
分类:其他好文   时间:2014-11-24 16:55:19    阅读次数:244
UVA 10285 Longest Run on a Snowboard
记忆化搜索,跟以前的做过的 滑雪 一样的。 DP+DFS。用dp[][]保存搜索记录,然后满足条件累加即可。 #include #include #include #include #include #include #include #include #include #include #include #include #include #define INF 0x7ffffff...
分类:其他好文   时间:2014-11-24 13:37:30    阅读次数:226
Longest Substring Without Repeating Characters解题报告
使用双指针,i遍历全部字符,start收集重复的次数,最后不重复出现的字符个数maxx为i-start+1;// main.cpp// Longest Substring//// Created by Bowie Hsu on 14/11/21.// Copyright (c) 2014年 Bowi...
分类:其他好文   时间:2014-11-24 13:21:59    阅读次数:142
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 longes...
分类:其他好文   时间:2014-11-24 00:49:37    阅读次数:239
poj 2739 Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 19699   Accepted: 10801 Description Some positive integers can be represen...
分类:其他好文   时间:2014-11-23 16:04:23    阅读次数:163
[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 fo...
分类:其他好文   时间:2014-11-23 14:21:58    阅读次数:205
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 ...
分类:其他好文   时间:2014-11-23 09:16:30    阅读次数:150
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!