# 700. Search in a Binary Search Tree

{% embed url="<https://leetcode.com/problems/search-in-a-binary-search-tree/>" %}

利用`BST`特征做`recursive`

```python
# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, val=0, left=None, right=None):
#         self.val = val
#         self.left = left
#         self.right = right
class Solution:
    def searchBST(self, root: TreeNode, val: int) -> TreeNode:
        if not root: return
        elif root.val == val: return root
        elif root.val > val:
            return self.searchBST(root.left, val)
        else:
            return self.searchBST(root.right, val)
```
