码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
[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...
分类:其他好文   时间:2015-01-23 18:12:03    阅读次数:171
LeetCode 003 Longest Substring Without Repeating Characters
题目描述:Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example,...
分类:其他好文   时间:2015-01-23 16:15:18    阅读次数:131
uva 10285 The Tower of Babylon(记忆化搜索)
Problem C Longest Run on a Snowboard Input: standard input Output: standard output Time Limit: 5 seconds Memory Limit: 32 MB   Michael likes snowboarding. That's not very surprising, since snow...
分类:其他好文   时间:2015-01-23 14:43:53    阅读次数:111
Leetcode#32 Longest Valid Parentheses
原题地址方法I:动态规划len[i]表示从i开始到结束的最长合法括号串长度,则:如果s[i] == "(" 且 s[i+len[i+1]+1]==")",len[i] = len[i+1] + 2否则len[i] = 0方法II:辅助栈跟那个直方图求最大面积有点类似,用一个栈保存合法括号串的长度,显...
分类:其他好文   时间:2015-01-23 06:10:15    阅读次数:138
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
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
perl学习之裸字
use strict包含3个部分。其中之一(use strict "subs")负责禁止乱用的裸字。这是什么意思呢?如果没有这个限制,下面的代码也可以打印出"hello"。my $x = hello;print "$x\n"; # hello这样使用不符合我们平常把字符串放在引号里的习惯,但是...
分类:其他好文   时间:2015-01-21 21:55:50    阅读次数:187
Leetcode#128 Longest Consecutive Sequence
原题地址1. 把所有元素都塞到集合里2. 遍历所有元素,对于每个元素,如果集合里没有,就算了,如果有的话,就向左向右拓展,找到最长的连续范围,同时在每次找的时候都把找到的删掉。这样做保证了同样的连续序列只会被遍历一次,从而保证时间复杂度。时间复杂度O(n)代码: 1 int longestConse...
分类:其他好文   时间:2015-01-20 17:29:55    阅读次数:126
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!