1,采用reverse的方法,来比较是不是palindrome2,reverse number的方法!!3,还要记得负数的情况package Leetcode;public class PalindromeNumber {public boolean isPalindrome(int x) { .....
分类:
其他好文 时间:
2014-10-26 08:00:01
阅读次数:
208
问题描述:
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is...
分类:
其他好文 时间:
2014-10-25 21:30:51
阅读次数:
191
HDU 5062 Beautiful Palindrome Number(数学题)...
分类:
其他好文 时间:
2014-10-25 10:36:49
阅读次数:
160
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting th...
分类:
其他好文 时间:
2014-10-25 09:21:10
阅读次数:
182
字符串hash。首先说下需要注意的地方:当对Mod取余时,可能造成本不相同的,取余结束之后相同了。
此时应对多个不同的Mod取余,多次计算只能说降低上述情况的发生。感觉正式比赛中不会有这种题,比较拼RP。
比如此题,Mod = 2^32,可以,Mod = 2^64,WA了。。。
#include
#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-10-24 19:01:22
阅读次数:
199
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 = "aab",
Return 1 s...
分类:
其他好文 时间:
2014-10-24 18:54:01
阅读次数:
111
Palindrome
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 53525
Accepted: 18481
Description
A palindrome is a symmetrical string, that is, a string read...
分类:
其他好文 时间:
2014-10-22 11:09:13
阅读次数:
194
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a...
分类:
其他好文 时间:
2014-10-21 23:16:15
阅读次数:
293
题意:一个长为N的字符串( 3
题目链接:http://poj.org/problem?id=1159
——>>状态:dp[i][j]表示第i个字符到第j个字符组成的字符串变成回文串的最少插入次数。
状态转移方程:
若sz[i] == sz[j],则:dp[i][j] = dp[i + 1][j - 1];
否则:dp[i][j] = min(dp[i + 1][j], dp[i][j...
分类:
编程语言 时间:
2014-10-21 21:37:52
阅读次数:
247
回文数字。玩过回文字符串之后在玩一个回文数字,相比于最长回文字符串的巧妙,这道题目唯一值得称道的地方可能就是那句Do this without extra space,可以说这是这道题目明面上给出的唯一束缚,当然如果要是看了提示的话,会发现输入的整数是有负整数的可能。也就是说还要处理负数的问题,在这...
分类:
其他好文 时间:
2014-10-21 00:47:55
阅读次数:
204