码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
LeetCode:Longest Common Prefix
题目描述: Write a function to find the longest common prefix string amongst an array of strings. 代码: string Solution::longestCommonPrefix(vector &strs) { string result = ""; if(strs.size(...
分类:其他好文   时间:2015-01-06 12:03:24    阅读次数:137
[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 its length is 3. 这题的线性解法是维护一个sliding w...
分类:其他好文   时间:2015-01-06 07:20:32    阅读次数:121
COJ 1411 Longest Consecutive Ones
题目大意:希望在 k 步之内,将尽可能多的1移到相邻的位置上这里依靠前缀和解决问题我们用pos[i]保存第i个1的位置,这里位置我以1开始用sum[i]保存前 i 个1从 0 点移到当前位置所需的步数每次进行判断能否将 st 号 到 la 号的1移到相邻位置,我们要先清楚,为了使移动步数最少,我们需...
分类:其他好文   时间:2015-01-05 00:19:23    阅读次数:111
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 fo...
分类:其他好文   时间:2015-01-05 00:18:13    阅读次数:147
【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 longest consecutive elements sequence i...
分类:其他好文   时间:2015-01-04 23:07:30    阅读次数:233
textarea 限制字数
$("textarea").keyup(function(){ //console.log($(this).val().length); var L=$(this).val().length; if(L>100){//100为设定的字数 $(this).val($(this).val().subs....
分类:其他好文   时间:2015-01-04 21:13:57    阅读次数:119
【Shell脚本学习25】Shell文件包含
像其他语言一样,Shell 也可以包含外部脚本,将外部脚本的内容合并到当前脚本。Shell 中包含脚本可以使用:. filename或source filename两种方式的效果相同,简单起见,一般使用点号(.),但是注意点号(.)和文件名中间有一空格。例如,创建两个脚本,一个是被调用脚本 subs...
分类:系统相关   时间:2015-01-04 18:59:09    阅读次数:149
leetcode 3 Longest Substring Without Repeating Characters
public class Solution { public int lengthOfLongestSubstring(String s) { int maxLen = 0; int maxLenTmp = 0; Map map = new HashMap( s.len...
分类:其他好文   时间:2015-01-04 11:03:57    阅读次数:145
Mysql 索引概念及设计原则
键类型:1.主键2.唯一键3.外键索引类型:1. Hash索引2. Ordered索引(BTREE/RTREE)索引的创建:1.主键会创建两个索引:Hash索引和Ordered索引2.唯一键会创建两个索引:Hash索引和Ordered索引3.一般定义的索引只创建Ordered索引主键和唯一键各个索引...
分类:数据库   时间:2015-01-04 01:06:20    阅读次数:308
【leetcode】Longest Valid Parentheses
Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substr...
分类:其他好文   时间:2015-01-03 22:20:40    阅读次数:131
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!