Skip to content

Commit 580725d

Browse files
authored
Merge pull request neetcode-gh#649 from MaratKhakim/100_Same_Tree_go
100. Same Tree Go
2 parents 17bf6c2 + 335d5ae commit 580725d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

go/100-Same-Tree.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
func isSameTree(p *TreeNode, q *TreeNode) bool {
2+
if p == nil && q == nil {
3+
return true
4+
}
5+
6+
if p == nil || q == nil || p.Val != q.Val {
7+
return false
8+
}
9+
10+
return isSameTree(p.Left, q.Left) && isSameTree(p.Right, q.Right)
11+
}

0 commit comments

Comments
 (0)