Q:Determine whether an integer is a palindrome. Do this without extra space.
这道题也是基础题,判断一个数是否是回文数,条件是不能使用额外的空间,意思就是说,你不能把一个Intege转换成string,然后对string进行回文字符串的判断。
另外,如果用Reverse Integer的方法,可能会造成数值溢出,比如判...
分类:
其他好文 时间:
2015-01-31 12:31:11
阅读次数:
169
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv...
分类:
其他好文 时间:
2015-01-31 11:54:13
阅读次数:
202
地址:http://poj.org/problem?id=1159题目需求:给你一个字符串,求最少添加多少字符可以使之构成回文串。题目解析: 简单做法是直接对它和它的逆序串求最长公共子序列长度len。n-len即为所求。(n为原串长度)即: 最少补充的字母数 = 原序列的长度 — 原串和逆序的最长公...
分类:
其他好文 时间:
2015-01-30 19:30:52
阅读次数:
153
Determine whether an integer is a palindrome. Do this without extra space.方法一:public class Solution { public boolean isPalindrome(int x) { S...
分类:
其他好文 时间:
2015-01-29 23:57:41
阅读次数:
222
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 convert...
分类:
其他好文 时间:
2015-01-29 12:50:33
阅读次数:
138
Palindrome
Time Limit:3000MS Memory Limit:65536KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
A palindrome is a symmetrical string, that is, a string read identic...
分类:
编程语言 时间:
2015-01-29 10:37:03
阅读次数:
177
题目链接:Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the...
分类:
其他好文 时间:
2015-01-28 21:30:17
阅读次数:
208
很简单粗暴的思路就是将整数转换为StringBuilder,然后前面和后面的字符分别相比,直至前面和后面的下标相遇程序终止,任何一次比较不想等就不成立。但上面说without extra space,为啥我的程序能通过?好吧,程序不算真的通过,我用到了额外的存储空间。...
分类:
其他好文 时间:
2015-01-28 09:43:58
阅读次数:
163
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 p...
分类:
其他好文 时间:
2015-01-27 18:23:55
阅读次数:
182
F -PalindromeTime Limit:3000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusPracticePOJ 1159DescriptionA palindrome is a symmetrical st...
分类:
其他好文 时间:
2015-01-27 13:00:56
阅读次数:
123