✔️ 100% Fastest Swift Solution, time: O(n), space: O(n).
\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     public var val: Int\n *     public var left: TreeNode?\n *     public var right
```\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     public var val: Int\n *     public var left: TreeNode?\n *     public var right: TreeNode?\n *     public init() { self.val = 0; self.left = nil; self.right = nil; }\n *     public init(_ val: Int) { self.val = val; self.left = nil; self.right = nil; }\n *     public init(_ val: Int, _ left: TreeNode?, _ right: TreeNode?) {\n *         self.val = val\n *         self.left = left\n *         self.right = right\n *     }\n * }\n */\nclass Solution {\n    // - Complexity:\n    //   - time: O(n), where n is the number of nodes.\n    //   - space: O(n), where n is the number of nodes.\n    \n    func isSymmetric(_ root: TreeNode?) -> Bool {\n        isMirror(root, root)\n    }\n    \n    \n    private func isMirror(_ left: TreeNode?, _ right: TreeNode?) -> Bool {\n        if left == nil, right == nil { return true }\n        \n        guard left?.val == right?.val else { return false }\n        \n        return isMirror(left?.left, right?.right) && isMirror(left?.right, right?.left)\n    }\n\n}\n```\n\nLet me know in comments if you have any doubts. I will be happy to answer.\n\nPlease upvote if you found the solution useful.
['Swift']