同时利用栈和队列的性质来比较头尾的数是否相等
class Solution {
public:
bool isPalindrome(int x) {
if(x<0) return false;
queue<int> a;
stack<int> b;
while(x!=0)
{
int temp=x%10;
a.push(temp);
b.push(temp);
x/=10;
}
while(!b.empty())
{
if(b.top() == a.front())
{
a.pop();
b.pop();
continue;
}
else return false;
}
return true;
}
};