题目出处:https://leetcode.com/problems/palindrome-number/
题目:Determine whether an integer is a palindrome. Do this without extra space.
翻译:判断一个整型数是否是回文数
思路:将整型数转化为字符串,依次比较首尾
代码:
public class Solution...
分类:
其他好文 时间:
2015-07-04 14:08:01
阅读次数:
171
Determine whether an integer is a palindrome. Do this without extra space.
题目:判断int数据是否为回文数
注意:负数不是回文数,0是最小的回文数
思路:此题和前面一道 求int数的反序差不多http://blog.csdn.net/xiabodan/article/details/46674133...
分类:
其他好文 时间:
2015-07-01 18:22:52
阅读次数:
154
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 the inte...
分类:
其他好文 时间:
2015-06-28 21:42:54
阅读次数:
133
1. Question确定一个数是否是回文数。要求不使用额外空间。Determine whether an integer is a palindrome. Do this without extra space.2. Solution如果是负数,就不是回文数。2.1 reverse integer...
分类:
其他好文 时间:
2015-06-23 23:04:49
阅读次数:
132
题目:判断一个数是不是回文数Determine whether an integer is a palindrome. Do this without extra space.思路:借助上一道求整数逆序的思路,判断逆序后的数和原数是否相等就行。要注意,负数都不是回文数11506 / 11506 te...
分类:
其他好文 时间:
2015-06-23 19:48:42
阅读次数:
111
题目链接:http://acm.swust.edu.cn/problem/797/Time limit(ms): 1000 Memory limit(kb): 10000DescriptionPalindromes are numbers that read the same forwar...
分类:
其他好文 时间:
2015-06-22 14:47:51
阅读次数:
155
题意:又是回文判断:该数是否是回文数原题来自:https://leetcode.com/problems/palindrome-number/分析:回文真多,直接把数反转来判断是否相等。 1 class Solution { 2 public: 3 bool isPalindrome(int...
分类:
其他好文 时间:
2015-06-18 21:42:04
阅读次数:
114
题目意思:判断是否为回文数,不许使用额外空间 ps:一直不理解额外空间的意思,int能用吗思路:1.比较头尾 2.翻转,越界问题需考虑 1 class Solution { 2 public: 3 bool isPalindrome(int x) { 4 if(x...
分类:
其他好文 时间:
2015-06-18 19:04:49
阅读次数:
96
回文数猜想Problem Description一个正整数,如果从左向右读(称之为正序数)和从右向左读(称之为倒序数)是一样的,这样的数就叫回文数。任取一个正整数,如果不是回文数,将该数与他的倒序数相加,若其和不是回文数,则重复上述步骤,一直到获得回文数为止。例如:68变成154(68+86),再变...
分类:
其他好文 时间:
2015-06-17 23:14:01
阅读次数:
226
题意:回文数字。原题来自:https://leetcode.com/problems/reverse-integer/分析:根据题目要求,Reverse digits of an integer.我理解为int的范围了,结果,这题很坑。最先wa的时候,我还以为int范围小了,就用long long,...
分类:
其他好文 时间:
2015-06-17 21:27:48
阅读次数:
146