Skip to content

Commit

Permalink
Fix either p or q nil check in isSameTree problem
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsathiya committed Feb 26, 2024
1 parent e905565 commit 979910a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/100-same-tree/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ type TreeNode struct {
}

func isSameTree(p *TreeNode, q *TreeNode) bool {
if p == nil || q == nil {
return true
}
if p == nil && q == nil {
return true
}
if p == nil || q == nil {
return false
}
if p.Val != q.Val {
return false
}
Expand Down

0 comments on commit 979910a

Please sign in to comment.