码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果)
CodeForces 632D Longest Subsequence
暴力。 虽然$a[i]$最大有${10^9}$,但是$m$最大只有${10^6}$,因此可以考虑暴力。 记$cnt[i]$表示数字$i$有$cnt[i]$个,记$p[i]$表示以$i$为倍数的情况下,最多能选出多少个数字。 $p[i]$可以暴力计算出来,最后就是找到$p[i]$最大的$i$,然后输出 ...
分类:其他好文   时间:2016-09-28 22:34:09    阅读次数:146
【poj3764】 The xor-longest Path
[http://poj.org/problem?id=3764] (题目链接) 今天的考试题,看到异或就有点虚,根本没往正解上想。。 题意:给出一棵带权树,请找出树上的一条路径,使其边上权值的异或和最大。 solution 首先我们考虑从根向下dfs,记录下每个点i到根上权值的异或和val[i]。根 ...
分类:其他好文   时间:2016-09-28 15:53:07    阅读次数:166
leetcode 3. Longest Substring Without Repeating Characters
本问题是求最长不重复子串。 给出一种方法: 例如:aplsdfgsjiuk,设置一个最长子串的起始位和结束位,a为起始位,b为结束位,当遍历aplsdfg时,下一位s重复,所以可以从d为起始位置在遍历。 时间复杂度为O(n)。 ...
分类:其他好文   时间:2016-09-27 11:29:14    阅读次数:95
freeCodeCamp:Find the Longest Word in a String
找到提供的句子中最长的单词,并计算它的长度。 函数的返回值应该是一个数字。 ...
分类:其他好文   时间:2016-09-26 17:41:25    阅读次数:97
leetcode--5. Longest Palindromic Substring
题目来自 https://leetcode.com/problems/longest-palindromic-substring/ 题目:Given a string S, find the longest palindromic substring in S. You may assume tha ...
分类:其他好文   时间:2016-09-25 17:26:09    阅读次数:149
[LeetCode #3] Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:其他好文   时间:2016-09-24 23:20:25    阅读次数:137
Lesson17 The longest suspension bridge in the world
Verrazano, an Italian about whom little is known, sailed into New York Harbour in 1524 and named it Angouleme. He described it as 'a very agreeable si ...
分类:其他好文   时间:2016-09-24 13:26:29    阅读次数:114
128. Longest Consecutive Sequence(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 longes ...
分类:其他好文   时间:2016-09-24 11:54:09    阅读次数:132
128. Longest Consecutive Sequence
...
分类:其他好文   时间:2016-09-24 10:37:45    阅读次数:145
32. Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the lo ...
分类:其他好文   时间:2016-09-24 07:01:04    阅读次数:144
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!