(TreeNode root1, TreeNode root2)
| 7 | } |
| 8 | |
| 9 | public boolean symmetric(TreeNode root1, TreeNode root2) |
| 10 | { |
| 11 | if(root1== null || root2==null) |
| 12 | return root1==root2; |
| 13 | if(root1.val != root2.val) return false; |
| 14 | boolean one = symmetric(root1.left,root2.right); |
| 15 | boolean two = symmetric(root1.right,root2.left); |
| 16 | return one && two; |
| 17 | } |
| 18 | } |