标签:leetcode
https://oj.leetcode.com/problems/palindrome-number/
http://fisherlei.blogspot.com/2012/12/leetcode-palindrome-number.html
public class Solution { public boolean isPalindrome(int x) { // Assume // Negative numbers cannot be palindrome if (x < 0) return false; // No extra space long reversed = 0; // In case overflow int t = x; while (t > 0) { reversed = reversed * 10 + t % 10; t /= 10; } return reversed == x; } }
标签:leetcode
原文地址:http://7371901.blog.51cto.com/7361901/1598406