mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 08:50:15 +08:00
添加 二叉树:以为使用了递归,其实还隐藏着回溯 go版本
添加 二叉树:以为使用了递归,其实还隐藏着回溯 go版本
This commit is contained in:
@ -336,6 +336,7 @@ class Solution:
|
|||||||
```
|
```
|
||||||
|
|
||||||
Go:
|
Go:
|
||||||
|
|
||||||
100.相同的树
|
100.相同的树
|
||||||
```go
|
```go
|
||||||
/**
|
/**
|
||||||
@ -351,7 +352,6 @@ func isSameTree(p *TreeNode, q *TreeNode) bool {
|
|||||||
case p == nil && q == nil:
|
case p == nil && q == nil:
|
||||||
return true
|
return true
|
||||||
case p == nil || q == nil:
|
case p == nil || q == nil:
|
||||||
fmt.Println(p,q)
|
|
||||||
fallthrough
|
fallthrough
|
||||||
case p.Val != q.Val:
|
case p.Val != q.Val:
|
||||||
return false
|
return false
|
||||||
|
Reference in New Issue
Block a user