# 9. Palindrome Number

{% embed url="<https://leetcode.com/problems/palindrome-number/>" %}

不用`convert to string`的话就只能对digit操作了。

```python
class Solution:
    def isPalindrome(self, x: int) -> bool:
        if x<0: return False
        digits = []
        while x:
            digits.append(x%10)
            x //= 10
        i, j = 0, len(digits)-1
        while i < j:
            if digits[i] != digits[j]: 
                return False
            i += 1
            j -= 1
        return True
```
