码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果)
POJ 3764 The xor-longest Path 字典树求最大异或
题意,一颗树,每个边有个值,在树上找一条简单路径,使得这条路径上的边权异或值最大 把这题模型转换一下, 对于任意一条路径的异或,表示为f(u, v) 则f(u, v) = f(1, u) ^ f(1, v) 这是显然的 其中f(1, i)是可以再O(n)内处理出来 然后就是在一个数组内,找两个数异或值最大 然后就可以用字典树来搞 每个数变成01串,  然后插入字典树,...
分类:其他好文   时间:2015-01-22 23:24:23    阅读次数:192
Longest Palindromic Substring
https://oj.leetcode.com/problems/longest-palindromic-substring/Given a stringS, find the longest palindromic substring inS. You may assume that the ma...
分类:其他好文   时间:2015-01-22 17:24:11    阅读次数:105
POJ 2739 Sum of Consecutive Prime Numbers( *【素数存表】+暴力枚举 )
Sum of Consecutive Prime NumbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 19895Accepted: 10906DescriptionSome positive integers can be ...
分类:其他好文   时间:2015-01-22 17:16:21    阅读次数:177
Leetcode: Longest Substring with At Most Two Distinct Characters
Given a string, find the length of the longest substring T that contains at most 2 distinct characters.For example, Given s = “eceba”,T is "ece" which...
分类:其他好文   时间:2015-01-22 14:52:17    阅读次数:134
[leetcode]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, and there exists one unique longes...
分类:其他好文   时间:2015-01-22 00:10:52    阅读次数:142
Codility NumberSolitaire Solution
1.题目: A game for one player is played on a board consisting of N consecutive squares, numbered from 0 to N ? 1. There is a number written on each squa...
分类:其他好文   时间:2015-01-21 18:08:23    阅读次数:340
Leetcode#128 Longest Consecutive Sequence
原题地址1. 把所有元素都塞到集合里2. 遍历所有元素,对于每个元素,如果集合里没有,就算了,如果有的话,就向左向右拓展,找到最长的连续范围,同时在每次找的时候都把找到的删掉。这样做保证了同样的连续序列只会被遍历一次,从而保证时间复杂度。时间复杂度O(n)代码: 1 int longestConse...
分类:其他好文   时间:2015-01-20 17:29:55    阅读次数:126
[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 for "abcabcbb" is "abc", which the length is...
分类:其他好文   时间:2015-01-20 15:42:24    阅读次数:132
[LeetCode][Python]14: Longest Common Prefix
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/longest-common-prefix/14: Longest Common PrefixWrite a fu...
分类:编程语言   时间:2015-01-19 20:39:03    阅读次数:205
Longest Substring Without Repeating Characters
https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/Given a string, find the length of the longest substring without repea...
分类:其他好文   时间:2015-01-18 23:57:54    阅读次数:264
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!