LeetCode 9 - Palindrome Number
Difficulty: easy
Problem Description
English (Palindrome Number)
Given an integer x, return true if x is a palindrome, and false otherwise.
Example 1:
1  |  | 
Example 2:
1  |  | 
Example 3:
1  |  | 
Constraints:
-2^31 <= x <= 2^31 - 1
Follow up: Could you solve it without converting the integer to a string?
Chinese (回文数)
给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。
回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。
- 例如,
121是回文,而123不是。 
示例 1:
1  |  | 
示例 2:
1  |  | 
示例 3:
1  |  | 
提示:
-2^31 <= x <= 2^31 - 1
Solution
Notice some edge cases:
- negative number
 - zero
 - multiples of 10
 - the number after palindrome is over the threshold of integer
 
C++
1  |  | 
LeetCode 9 - Palindrome Number
      http://wasprime.github.io/Algorithm/LeetCode/LeetCode-9-Palindrome-Number/