码迷,mamicode.com
首页 >  
搜索关键字:palindrome    ( 1561个结果
131 Palindrome Partitioning
131 Palindrome Partitioning这道题先是标识出所有的 s[i:j+1] 是否为 palindrome, 然后在暴力搜索就好class Solution: def __init__(self): self.dp = [] self.ans = ...
分类:其他好文   时间:2015-08-05 06:28:54    阅读次数:103
132 Palindrome Partitioning II
132 Palindrome Partitioning II这道题就是标识出s[i:j+1]是否为palindrome, 然后dp找出最小分割class Solution: # @param {string} s # @return {integer} def minCut(sel...
分类:其他好文   时间:2015-08-05 06:26:36    阅读次数:110
LeetCode:Palindrome Linked List
Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?回文链表即原链表与逆置链表相同,采用辅助栈的特点将链表逆置。(知道链表长...
分类:其他好文   时间:2015-08-04 13:09:21    阅读次数:188
LeetCode 边做边记录
其实就是把有道云笔记的东西搬过来,不定期会更新随便写写的东西,很多都需要优化,如果有人看到,希望能给点建议,谢谢!1.Palindrome Number public class Solution { public boolean isPalindrome(int x) { i...
分类:其他好文   时间:2015-08-04 11:04:36    阅读次数:116
回文数问题
问题描述 我在2008年6月写了一篇随笔“可以使用C#语言的在线ACM题库”,其中提到 Sphere Onlile Judge (SPOJ) 网站。现在我们来看看该网站 SPOJ Problem Set (classical) 中的“5. The Next Palindrome”。这道题目的主要内容如下所示: The Next Palindrome: A positive inte...
分类:其他好文   时间:2015-08-04 08:13:58    阅读次数:158
POJ 3280 Cheapest Palindrome(区间DP)
?? Cheapest Palindrome Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6894   Accepted: 3344 Description Keeping track of all the cows can be a tricky task ...
分类:其他好文   时间:2015-08-03 22:49:12    阅读次数:216
LeetCode Day1
Palindrome Linked List 1 /** 2 * LeetCode: Palindrome Linked List 3 * Given a singly linked list, determine if it is a palindrome. 4 * Could yo...
分类:其他好文   时间:2015-08-03 20:52:05    阅读次数:124
CodeForces 486C Palindrome Transformation
题目:戳我 题意:给定长度为n的字符串,给定初始光标位置p,支持4种操作,left,right移动光标指向,up,down,改变当前光标指向的字符,输出最少的操作使得字符串为回文。 分析:只关注字符串n/2长度,up,down操作是固定不变的,也就是不能优化了,剩下就是left,down的操...
分类:其他好文   时间:2015-08-03 20:39:34    阅读次数:116
POJ 3974-Palindrome(Manacher算法)
题目地址:POJ 3974 题意:求最长的回文串。 思路:同样是用Mancher算法在O(n)的时间内解决(我其实是来练练板子的#include #include #include #include #include #include #include <algorithm...
分类:编程语言   时间:2015-08-03 14:39:08    阅读次数:99
贪心+构造 Codeforces Round #277 (Div. 2) C. Palindrome Transformation
题目传送门 1 /* 2 贪心+构造:因为是对称的,可以全都左一半考虑,过程很简单,但是能想到就很难了 3 */ 4 /************************************************ 5 Author :Running_Time 6 Creat...
分类:其他好文   时间:2015-08-03 14:27:13    阅读次数:149
1561条   上一页 1 ... 88 89 90 91 92 ... 157 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!