码迷,mamicode.com
首页 >  
搜索关键字:longest substring    ( 5540个结果
[LeetCode]76.Minimum Window Substring
题目Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example, S = “ADOBECODEBANC” T = “ABC” Minimum window is “BANC”.Note...
分类:Windows程序   时间:2015-02-24 13:48:53    阅读次数:210
js中substr与substring的差别
Js的substring和C#的Substring的作用都是从一个字符串中截取出一个子字符串,但它们的用法却有非常大的不同,下边我们来比較看看:Js的substring语法:程序代码String.substring(start, end)说明:返回一个从start開始到end(不包括end)的子字符...
分类:Web程序   时间:2015-02-24 13:44:30    阅读次数:108
LeetCode 笔记24 Palindrome Partitioning II (智商碾压)
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs...
分类:其他好文   时间:2015-02-24 13:43:16    阅读次数:150
LeetCode Substring with Concatenation of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without ...
分类:其他好文   时间:2015-02-23 21:15:50    阅读次数:214
LeetCode Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.思路分析:这题很简单,基本就是以第一个字符串为标准,同时扫描后面的字符串对应index 字符是否相同,找到最大的相同前缀。但是实现的时候还是要注意一些corner case,比如输入数组为空或者只包含一个字符串的情况。AC Co...
分类:其他好文   时间:2015-02-23 12:02:19    阅读次数:145
USACO Longest Prefix 【水】
用Dp的思想解决了这道题目,也就是所谓的暴力= =题意:给出一个集合,一个字符串,找出这个字符串的最长前缀,使得前缀可以划分为这个集合中的元素(集合中的元素可以不全部使用)。还不会Trie 树QAQSource Code:/*ID: wushuai2PROG: prefixLANG: C++*///...
分类:其他好文   时间:2015-02-21 14:14:36    阅读次数:116
动态规划---最长上升子序列问题(O(nlogn),O(n^2))
LIS(Longest Increasing Subsequence)最长上升子序列 或者 最长不下降子序列。很基础的题目,有两种算法,复杂度分别为O(n*logn)和O(n^2) 。**********************************************************...
分类:其他好文   时间:2015-02-20 22:00:21    阅读次数:245
HDU1867:A + B for you again(KMP)
题意:找出一个最大的公共子串,这个子串是一个字符串的尾串(tail substring ),同时是另外那个字符串的头串(head substring),是满足A+B的长度strlen(A+B)达到最小值,这里面要注意的一个问题是,谁做模式串P是不一定的,所以要分别比较不同字符串作为模式的KMP值。 思路:让两个串分别做模式串。看谁KMP的结束的时候匹配的字符字符的个数最多就好。 当然也可以把两...
分类:其他好文   时间:2015-02-18 09:37:27    阅读次数:144
leetcode 104. Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:其他好文   时间:2015-02-17 19:54:58    阅读次数:146
hdu1238---Substrings
Problem Description You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the g...
分类:其他好文   时间:2015-02-17 16:33:16    阅读次数:146
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!