1 class Solution {
2 public:
3 bool isPalindrome(int x) {
4
5 if (x < 0)return false;
6
7 list<int> l;
8 while (x){
9 l.push_back(x % 10);
10 x /= 10;
11 }
12
13 while (!l.empty()) {
14 if (l.front() == l.back()) {
15 l.pop_front();
16 if(!l.empty())
17 l.pop_back();
18 }
19 else
20 return false;
21 }
22 return true;
23 }
24 };