funcisSymmetric(_root: TreeNode?) -> Bool { guardlet root = root else { returntrue } var queue = [root.left, root.right] while!queue.isEmpty { let left = queue.removeFirst() let right = queue.removeFirst() if left ===nil&& right ===nil { continue } if left ===nil|| right ===nil|| left!.val != right!.val { returnfalse } queue.append(left?.left) queue.append(right?.right) queue.append(left?.right) queue.append(right?.left) } returntrue }