public boolean isSymmetricIterative(TreeNode root) {
        if (root == null) return true;
        LinkedList<TreeNode> leftNodes = new LinkedList<TreeNode>();
        LinkedList<TreeNode> rightNodes = new LinkedList<TreeNode>();
        leftNodes.add(root.left);
        rightNodes.add(root.right);
        while (!leftNodes.isEmpty() && !rightNodes.isEmpty()) {
            TreeNode leftNode = leftNodes.remove();
            TreeNode rightNode = rightNodes.remove();
            if (leftNode == null && rightNode == null) continue;
            if (leftNode == null || rightNode == null) return false;
            if (leftNode.val != rightNode.val) return false;
            leftNodes.add(leftNode.left);
            leftNodes.add(leftNode.right);
            rightNodes.add(rightNode.right);
            rightNodes.add(rightNode.left);
        }
        return true;
    }