码迷,mamicode.com
首页 >  
搜索关键字:partitioning    ( 428个结果
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
[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
[LeetCode] Palindrome Partitioning II [12]
题目:For example, given s = "aab", Return 1 since the palindrome partitioning ["aa","b"] could be produced using 1 cut 解题思路:给一个字符串,如果字符串可以划分成若干子回文字符串,返回最小的划分数量。 这个题如果还用之前求所有划分组合的循环加递归方法的话,就会得到超时的错误。这是就要考虑别的方法,动态规划倒是一个不错的方法,但是动态规划最重要的是要找到动态方程。本题的动态方程: dp[i] =...
分类:其他好文   时间:2014-06-08 14:56:58    阅读次数:257
[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
Scramble String
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:其他好文   时间:2014-06-04 20:11:38    阅读次数:303
LeetCode: Scramble String [87]
【题目】 Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": great / gr eat / \ / g r e at / ...
分类:其他好文   时间:2014-06-01 09:41:05    阅读次数:196
Palindrome Partitioning
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv...
分类:其他好文   时间:2014-05-30 16:04:06    阅读次数:237
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...
分类:其他好文   时间:2014-05-30 15:13:10    阅读次数:262
[leetcode]Palindrome Partitioning @ Python
原题地址:https://oj.leetcode.com/problems/palindrome-partitioning/题意:Given a strings, partitionssuch that every substring of the partition is a palindrome...
分类:编程语言   时间:2014-05-29 18:26:15    阅读次数:334
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
428条   上一页 1 ... 40 41 42 43 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!