> For the complete documentation index, see [llms.txt](https://ucan.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ucan.gitbook.io/notes/tree/101.-symmetric-tree.md).

# 101. Symmetric Tree

```java
class Solution {
    public boolean isSymmetric(TreeNode root) {
        return recursion(root, root);
    }
    
    private boolean recursion(TreeNode first, TreeNode second){
        if(first==null || second == null){
            return first==second;
        }
        
        if(first.val!=second.val) return false;
        if(recursion(first.left, second.right)){
            return recursion(first.right, second.left);
        }else{
            return false;
        }
    }
}
```
