https://oj.leetcode.com/problems/palindrome-number/Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.So...
分类:
其他好文 时间:
2015-02-12 20:01:09
阅读次数:
204
改写要求1:用单链表实现#include #include using namespace std;struct LinkNode{ int data; LinkNode *next;};class PALINDROME{ int low,up; int ...
分类:
编程语言 时间:
2015-02-11 18:28:20
阅读次数:
145
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2015-02-10 15:04:06
阅读次数:
186
题目链接
n2n^2 的预处理i~j是不是回文串然后 n2n^2 的DP11584 Partitioning by PalindromesCan you read upside-down?
We say a sequence of characters is a
palindrome if it is the same written
forwards and backwards. For e...
分类:
其他好文 时间:
2015-02-09 16:06:59
阅读次数:
103
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...
分类:
其他好文 时间:
2015-02-09 14:09:48
阅读次数:
145
这个问题就是判断整数是否为回文。
思路1:利用一个字符串,将int转换为字符串,但这样会需要使用额外的内存
思路2:经整数翻转,然后与原来的整数比较是否相等,但这样可能翻转后的整数会溢出
思路3:不断取整数的最高位和最低位(10进制下)进行比较,相等则取次高位和次低位进行比较
class Solution {
public:
bool isPalindrome(int x) {
...
分类:
其他好文 时间:
2015-02-08 16:52:51
阅读次数:
123
题目描述:Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie...
分类:
其他好文 时间:
2015-02-07 14:22:19
阅读次数:
175
题目 这道题是迄今为止最快通过的一道题,改了两次就过了,runtime一般(中等偏下,这点不太满意)。Palindrome就是判断一个整数是否对称。Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negativ...
分类:
其他好文 时间:
2015-02-07 13:16:36
阅读次数:
141
一、 题目
试确定一个整数是否为回文数。并不使用额外的空间。
提示:
负整数可能是回文数吗?(例如 -1)
如果你想要将整数转换成字符串,那么你注意到不能使用额外的空间的限制。
可能你尝试翻转整数,但是,如果你已经解决这个问题“逆向整型”,你要知道,颠倒整数可能会溢出的情况。那么你会如何处理这样的情况呢?
要有解决这个问题的一种更通用的方法。
二、 分析
了解题目的意思后,其实问题...
分类:
其他好文 时间:
2015-02-06 14:55:47
阅读次数:
151
Cheapest Palindrome
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 6186
Accepted: 3014
Description
Keeping track of all the cows can be a tricky task so F...
分类:
其他好文 时间:
2015-02-05 18:24:56
阅读次数:
146