Skip to content

Commit 8ff3546

Browse files
halfrostdezhiy
authored andcommitted
Update solution 0700
1 parent a7ce19c commit 8ff3546

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

leetcode/0700.Search-in-a-Binary-Search-Tree/700.Search in a Binary Search Tree.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
package leetcode
22

3-
type TreeNode struct {
4-
Val int
5-
Left *TreeNode
6-
Right *TreeNode
7-
}
3+
import (
4+
"github.com/halfrost/LeetCode-Go/structures"
5+
)
6+
7+
// TreeNode define
8+
type TreeNode = structures.TreeNode
9+
10+
/**
11+
* Definition for a binary tree node.
12+
* type TreeNode struct {
13+
* Val int
14+
* Left *TreeNode
15+
* Right *TreeNode
16+
* }
17+
*/
818

919
func searchBST(root *TreeNode, val int) *TreeNode {
1020
if root == nil {

leetcode/0700.Search-in-a-Binary-Search-Tree/README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [700. Search in a Binary Search Tree](https://leetcode-cn.com/problems/search-in-a-binary-search-tree/)
1+
# [700. Search in a Binary Search Tree](https://leetcode.com/problems/search-in-a-binary-search-tree/)
22

33
## 题目
44

@@ -38,13 +38,24 @@ Find the node in the BST that the node's value equals val and return the subtree
3838
## 代码
3939

4040
```go
41+
4142
package leetcode
4243

43-
type TreeNode struct {
44-
Val int
45-
Left *TreeNode
46-
Right *TreeNode
47-
}
44+
import (
45+
"github.com/halfrost/LeetCode-Go/structures"
46+
)
47+
48+
// TreeNode define
49+
type TreeNode = structures.TreeNode
50+
51+
/**
52+
* Definition for a binary tree node.
53+
* type TreeNode struct {
54+
* Val int
55+
* Left *TreeNode
56+
* Right *TreeNode
57+
* }
58+
*/
4859

4960
func searchBST(root *TreeNode, val int) *TreeNode {
5061
if root == nil {
@@ -58,4 +69,5 @@ func searchBST(root *TreeNode, val int) *TreeNode {
5869
return searchBST(root.Left, val)
5970
}
6071
}
72+
6173
```

0 commit comments

Comments
 (0)