题目描述
blablabla
样例
class Solution {
public:
bool isSymmetric(TreeNode* root) {
stack<TreeNode*> left;
vector<int> vval;
auto p = root;
while(p||left.size()){
while(p){
left.push(p);
p = p->left;
}
auto q = left.top();
left.pop();
vval.push_back(q->val);
if(q->right){
p = q->right;
}
}
int i= 0, j = vval.size()-1;
while(i<j){
if(vval[i]!=vval[j]) return false;
i++;
j--;
}
return true;
}
};