码迷,mamicode.com
首页 >  
搜索关键字:valueerror substring    ( 4073个结果
Palindrome Partitioning II
题目 Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. For example, given s = "a...
分类:其他好文   时间:2014-06-20 13:44:18    阅读次数:234
Manacher算法--O(n)内求回文子串
昨天做了leetcode里的     Longest Palindromic Substring ,一开始用动态规划O(N^2),不管怎么改都超时了。。。于是在大神的帮助下,找到了传说中的Manacher算法,居然能在O(n)内求出来,瞬间给跪了。 本屌认为,这个算法主要是充分的利用了以前的匹配的结果,来起到了降低时间复杂度的作用,这点跟KMP算是有点类似。在预处理时有个小技巧就是将第0,1为设...
分类:其他好文   时间:2014-06-20 12:15:22    阅读次数:305
[LeetCode] Palindrome Partition [11]
题目:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. 解题思路: 回文划分,题目意思是给一个字符串,找出将字符串划分为一系列回文子串的各种可能组合。例如,一个子串“aab“,你需要返回["aa","b"],["a","a","b"]。这个题目的解法也是非常的典型---循环加递归,...
分类:其他好文   时间:2014-06-09 23:24:11    阅读次数:256
T4 生成实体和简单的CRUD操作
1) { string after = field.Substring(1); result = first + after; } return result; ...
分类:其他好文   时间:2014-06-08 19:19:20    阅读次数:347
MySql 同一个列中的内容进行批量修改
问题重现: MySql 数据库中,一给列的内容中包括 “.wmv”     需要将 “.” 后的wmv格式 换为“flv” 解决办法 update video_info set file_path=substring(file_path,1,length(file_path)-3); 先执行以上SQL进行删除; update video_info set file_path =...
分类:数据库   时间:2014-06-08 16:38:39    阅读次数:262
leetcode——Longest Substring Without Repeating Characters 求链表中无重复字符的最大字串长度(AC)
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 3. Fo...
分类:其他好文   时间:2014-06-08 16:27:47    阅读次数:231
js 判断字符串是否包含某字符串,String对象中查找子字符,indexOf
var Cts = "bblText";   if(Cts.indexOf("Text") > 0 ) {     alert('Cts中包含Text字符串'); } indexOf用法:  返回 String 对象内第一次出现子字符串的字符位置。         strObj.indexOf(subString[, startIndex])         参数  ...
分类:Web程序   时间:2014-06-08 05:00:36    阅读次数:300
[LeetCode] Longest Substring Without Repeating Characters [15]
题目: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 3. For "bbbbb" the longest substring is "b", with the length...
分类:其他好文   时间:2014-06-08 03:06:52    阅读次数:221
java实现串的匹配和替换
/** *测试类,测试两个功能类,MatchBrote_force类和subString_act类的功能实现 *创建的类为TestMatchBrote_force *@author LZ *@vesion 6.2 */ //import...
分类:编程语言   时间:2014-06-07 22:14:47    阅读次数:369
[LeetCode] Longest Palindromic Substring [14]
最长回文字串,相信做过Palindrome Partitioning II 这个题的同学应该可以很快做出来。没错,这个题还可以使用动态规划方法得到一个时间复杂度为O(n^2)的解法,当然如果你想要更好的时间复杂度的算法也是有的。好的,我们先来看看时间复杂度为O(n^2)的算法。 代码实现--动态规划O(n^2) 相信如果你在网上看过了别人的算法,你会发现我的算法是最简洁的。哈哈,这个题需要注意的是如果你用惯了vector的话,你这里肯定会得到超时的提示... ...代码二--复杂度为O(n)的算法...
分类:其他好文   时间:2014-06-07 12:08:43    阅读次数:224
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!