码迷,mamicode.com
首页 >  
搜索关键字:longest substring    ( 5540个结果
【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 concatenati...
分类:其他好文   时间:2014-05-28 04:03:54    阅读次数:240
LeetCode Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. 要减少比较次数。在实现过程中我的想法是,2个2个比较,那么只要遍历一次数组就好。而且,在比较过程中,以较短的那个长度作为最大比...
分类:其他好文   时间:2014-05-26 21:29:43    阅读次数:203
字符串的截取
1.PHP和js同样是弱类型的语言 字符串的截取php中: $str ="hello world!"; substr($str,1,2);//从字符串的下标为1的地方截取2个字符, eljs中 var str = "hello world!"; str.substring(1,2);//e ...
分类:其他好文   时间:2014-05-26 09:55:57    阅读次数:243
Perl中的字符串操作函数
1、$position = index(string,substring,skipchars); 该函数返回子串substring在字符串string中的位置,如果不存在,则返回-1;参数skipchars是可选参数,表示查找之前跳过的字符数,即:从该位置处开始查找;2、rindex(string,...
分类:其他好文   时间:2014-05-26 08:22:13    阅读次数:234
leetcode -day21 Longest Substring Without Repeating Characters
?? 1、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 letter...
分类:其他好文   时间:2014-05-26 05:03:19    阅读次数:172
求两个字符串最长公共子串(动态规划)
code如下: //Longest common sequence, dynamic programming method void FindLCS(char *str1, char *str2) { if(str1 == NULL || str2 == NULL) return; int length1 = strlen(str1)+1; int length2 = strlen(...
分类:其他好文   时间:2014-05-26 04:56:50    阅读次数:215
leetcode题目:Sum Root to Leaf Numbers和Longest Consecutive Sequence
题目一: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Fin...
分类:其他好文   时间:2014-05-26 04:06:41    阅读次数:248
【leetcode】Minimum Window Substring
问题: 给定两个字符串,S,T,返回S中包含T中所有字符的最短的字串,若不存在,则返回"".时间复杂度为O(n)。 例如:S = "ADOBCODEBANC"           T = "ABC"          返回BANC 生活场景: 把问题具体化现实化一点。有n层楼,每层楼里放有一个物品,现在老板给你一个物品清单,里面是要你集齐的物品,你可以乘坐电梯,但是电梯只停一次,停在哪...
分类:Windows程序   时间:2014-05-25 21:27:17    阅读次数:438
LeetCode——Palindrome Partition
Palindrome Partitioning   Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = "...
分类:其他好文   时间:2014-05-24 14:29:45    阅读次数:222
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...
分类:其他好文   时间:2014-05-22 16:05:56    阅读次数:239
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!