码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果
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 ...
分类:其他好文   时间:2017-07-16 13:40:04    阅读次数:207
LeetCode 之 Longest Valid Parentheses(栈)
【问题描写叙述】 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(() ...
分类:其他好文   时间:2017-07-16 12:33:44    阅读次数:162
[leetcode-525-Contiguous Array]
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Example 2: 思路: 将0改为-1,将原题目改成求最大连续区间,区间 ...
分类:其他好文   时间:2017-07-16 00:03:16    阅读次数:150
1096. Consecutive Factors (20)
Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, a ...
分类:其他好文   时间:2017-07-16 00:02:59    阅读次数:199
409. Longest Palindrome
Map.Entry<> entry : map.entrySet() ...
分类:其他好文   时间:2017-07-15 12:46:39    阅读次数:90
hdu2196树形dp
有一棵树,找每个节点所能到达的最远距离是多少 dis[u][0]正向最大距离 dis[u][1]正向次大距离 dis[u][2]反向最大距离 先一边dfs求出每个节点的正向最大距离(就是向下)和次向最大距离,以及longest记录下当前节点的正向最大距离路径的子节点(为了第二遍dfs,判断这一条路是 ...
分类:其他好文   时间:2017-07-15 12:35:21    阅读次数:137
leetCode- Longest Palindromic Substring
判断回文(recursive) 两个条件: string中*s.end() 是‘\0’. 不使用递归: 得到最长的子回文字符串,最简单的做法得到所有字符串是否回文,记录长度,比较得到最长的。 要进行两次循环,时间复杂度高。O(n^3); 改进中心扩展法: 字符串可能为奇数个或偶数个,奇数个时从一个中 ...
分类:其他好文   时间:2017-07-12 21:26:50    阅读次数:135
LeetCode - Longest Substring Without Repeating Characters
题目描述: 找出一个字符串中,不含有相同字符的最长子串。 做法: 开一个200的bool数组标记,Ascll码 是否已经出现过了。遍历即可。 AC代码: class Solution { int a[200]; public: int lengthOfLongestSubstring(string ...
分类:其他好文   时间:2017-07-12 13:51:37    阅读次数:112
LeetCode - Longest Consecutive Sequence
题目描述: 给一个数组,找出其中连续的最长是: 如 -1 1 20 0 3 100 2 最长连续是 -1 0 1 2 3 返回 5 做法:用字典树标记数字是否出现过。起到hash作用。然后在遍历 拓展左右两个端点。讲道理,特地用了字典树就是便于删除元素,防止 1 - 10000 这样的数据 搜寻N^ ...
分类:其他好文   时间:2017-07-12 13:32:00    阅读次数:104
求最长公共子串 Longest Common Subsequence
求最长公共子串 Longest Common Subsequence ...
分类:其他好文   时间:2017-07-12 13:31:23    阅读次数:152
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!