JAVA EASY SOLUTION BEATS  100%| 0MS 
IntuitionTo check if a tree is symmetric, think of folding it down the middle. If the left side is a mirror image of the right side, then the tree is symmetric.
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
To check if a tree is symmetric, think of folding it down the middle. If the left side is a mirror image of the right side, then the tree is symmetric.

For every node on the left, there should be a matching node on the right with the same value, and their children should also be flipped and symmetric. If at any point the nodes or their children don't match, the tree is not symmetric.

# Approach
<!-- Describe your approach to solving the problem. -->

Handles base cases:
 -Returns true if both nodes are null.
 -Returns false if only one node is null.
 -Checks the current node values (p.val == q.val).
 -Recursively compares the left and right children for symmetry:
    -Left subtree of p vs. right subtree of q.
    -Right subtree of p vs. left subtree of q.


# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(n)

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {
    public boolean check(TreeNode p,TreeNode q){
        if(p==null && q==null) return true;
        if(p==null || q==null) return false;

        return (p.val==q.val && check(p.left,q.right) && check(p.right,q.left));
    }
    public boolean isSymmetric(TreeNode root) {
        if(root==null) return true;
        return check(root.left,root.right);
        
    }
}
```
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Recursion', 'Binary Tree', 'Java']