Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 139d6b6

Browse files
Add Solution.go for 0100.Same Tree
1 parent 6d74f4f commit 139d6b6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎solution/0100.Same Tree/Solution.go‎

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /