Here is my code. It first store the in order traversal including NULL nodes in to a vector and check the symmetry of the vector. OJ keeps telling me:

Input: {1,2,3,3,#,2,#}

Output: true

Expected: false

My serialized vector would be {3, 2, #, 1, 2, 3, #} and the symmetry check on the vector would be false. Could anyone point out what is wrong in my code?

bool isSymmetric(TreeNode *root) {

```
vector<TreeNode *> nodes;
InOrderTraversal(root, nodes);
int size = nodes.size();
for (int i = 0; i < size; i++) {
TreeNode *node1 = nodes[i];
TreeNode *node2 = nodes[size - 1 - i];
if (node1 && node2) {
if (node1->val != node2->val)
return false;
} else if (node1 || node2) {
return false;
}
}
return true;
}
void InOrderTraversal(TreeNode *node, vector<TreeNode *> &nodes)
{
if (node) {
InOrderTraversal(node->left, nodes);
}
nodes.push_back(node);
if (node) {
InOrderTraversal(node->right, nodes);
}
}
```