LeetCode 9 Palindrome Number
2016-04-05 21:27
288 查看
9. Palindrome Number
My SubmissionsQuestion
Editorial Solution
Total Accepted: 116450 Total
Submissions: 370999 Difficulty: Easy
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Subscribe to see which companies asked this question
Show Tags
Show Similar Problems
Have you met this question in a real interview?
Yes
No
Discuss
判断一个数是不是回文数
如果是负数,直接返回false;
水题
class Solution { public: bool isPalindrome(int x) { if(x<0) return false; char num[20]; sprintf(num,"%d",x); int len=strlen(num); for(int i=0,j=len-1;i<=j;i++,j--) if(num[i]!=num[j]) return false; return true; } };
相关文章推荐
- java.lang.UnsatisfiedLinkError: Native method not found
- ThinkPHP的静态化页面方法
- 简单的选项栏设置。
- c#调用c++ dll的一个例子
- Java入门:基础算法之求数组元素的和
- 软件工程结对作业02
- poj1061 青蛙的约会(扩展欧几里得)
- 鼠标设置感兴趣区域(ROI)
- php之文件载入include, include_once,require,require_once
- 【codevs 2981】题解
- LeetCode #002 Add Two Numbers
- JavaScript 防篡改对象
- POJ 2429 GCD & LCM Inverse(Pollard_rho法质因数分解)
- Jenkins插件之AnsiColor
- JavaMelody 系统监控软件
- Elasticsearch——Search的基本介绍
- Executing Raw SQL Queries using Entity Framework
- Libiconv裁剪
- 自定义 View 基础和原理
- P2P系统、一致性哈希、DHT