(t1, t2 *TreeNode)
| 23 | } |
| 24 | |
| 25 | func equalTrees(t1, t2 *TreeNode) bool { |
| 26 | if (t1 == nil && t2 != nil) || (t1 != nil && t2 == nil) { |
| 27 | return false |
| 28 | } |
| 29 | |
| 30 | if t1 == nil && t2 == nil { |
| 31 | return true |
| 32 | } |
| 33 | |
| 34 | return t1.Val == t2.Val && |
| 35 | equalTrees(t1.Left, t2.Left) && |
| 36 | equalTrees(t1.Right, t2.Right) |
| 37 | } |