码迷,mamicode.com
首页 >  
搜索关键字:palindrome partition    ( 4210个结果
uva 10617 Again Palindrome (DP)
uva 10617 Again Palindrome题目大意:给出一段字符串,可进行删除操作,可以删除任意位置任意个数(可以是0)的字符。问,进行删除操作使原本字符串变成回文字符串,有几种方式。解题思路:dp[i][j]=1(i==j)单独一个字符也是回文字符串dp[i][j] = 1 (i == j)单独一个字符也是回文字符串s[i]!=s[j]时,dp[i][j]=dp[i+1][j]+dp[i...
分类:其他好文   时间:2015-04-08 21:34:45    阅读次数:135
LeetCode—Palindrome Number 数字是否是回文数字
Determine whether an integer is a palindrome. Do this without extra space. 检测当前数字是否是回文数字,同时不能增加额外的内存空间,这里一个注意的点就是 负数 都不可能是回文数字 然后是检测出来每一位数字进行比较 代码还是写得比较繁琐,主要的一个点就是数字的位数是基数位和偶数位的时候处理的过程是不同的 c...
分类:其他好文   时间:2015-04-08 16:37:01    阅读次数:115
Leetcode: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 = "aab", Return [ ["aa","...
分类:其他好文   时间:2015-04-08 15:06:58    阅读次数:79
Partition List
public class Solution { public ListNode partition(ListNode head, int x) { if(head==null) return head; ListNode h = new ListNode(-1); ...
分类:其他好文   时间:2015-04-08 14:31:43    阅读次数:101
LeetCode --- 86. Partition List
题目链接:Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of t...
分类:其他好文   时间:2015-04-07 23:33:18    阅读次数:292
LeetCode #Valid Palindrome#
LeetCode #Valid Palindrome# 我的Python解答: """ Programmer : EOF e-mail : jasonleaster@gmail.com Date : 2015.04.07 File : vp.py """ import string ...
分类:其他好文   时间:2015-04-07 17:49:59    阅读次数:99
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-04-07 17:01:07    阅读次数:160
最小的k个数 2.5
基于partition做的,当index!=k时一直while循环 如果indexk,在前面找 另外最后的结果如果是0到k-1这k个数包括k-1的话,那么开始k要-1传入数组 如果不包括k-1的话,那么可以不用减1 复杂度为NlogN 另外有NlogK的算法,利用最小堆 利用partition的解法...
分类:其他好文   时间:2015-04-07 11:35:03    阅读次数:177
uva 10739 String to Palindrome (dp)
uva 10739 String to PalindromeIn this problem you are asked to convert a string into a palindrome with minimum number of operations. The operations are described below:Here you’d have the ultimate free...
分类:其他好文   时间:2015-04-07 10:02:16    阅读次数:119
POJ 3974 Palindrome Manacher
题目大意给出一个字符串,求出这个字符串的最长回文子串。思路前来学习著名的Manacher算法。 这是一个线性时间求出回文子串的算法。具体来说,对于我们弄出的一个回文串,它对于后面的串并不是,没有用的,因为它的左右两侧是相同的,那么自然可以用左边的信息去更新右边。 设p[i]p[i]为第ii个字符的回文半径,_max\_max为max{p[i]+i}max\{p[i] + i\},也就是最远可以更...
分类:其他好文   时间:2015-04-07 09:47:35    阅读次数:119
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!