Solution
C++ []\nclass Solution {\npublic:\n    TreeNode* searchBST(TreeNode* root, int val) {\n        if(root==NULL) return root;\n        if(root->val==val) return ro
```C++ []\nclass Solution {\npublic:\n    TreeNode* searchBST(TreeNode* root, int val) {\n        if(root==NULL) return root;\n        if(root->val==val) return root;\n        if(root->val>val) return searchBST(root->left,val);\n        else return searchBST(root->right,val);\n    }\n};\n```\n\n```Python3 []\nclass Solution:\n    def searchBST(self, root: Optional[TreeNode], val: int) -> Optional[TreeNode]:\n\n        def bst(node):\n            if not node:\n                return None\n\n            if val > node.val:\n                return bst(node.right)\n            elif val < node.val:\n                return bst(node.left)\n            else:\n                return node\n            \n            return None\n\n        return bst(root)\n```\n\n```Java []\nclass Solution {\n    public TreeNode searchBST(TreeNode root, int val) {\n        while (root!=null) {\n            if (root.val==val) {\n                return root;\n            }  \n            else if (root.val<val) {\n                root = root.right;\n            }\n            else {\n                root = root.left;\n            } \n        }\n        return null;\n    }\n}\n```\n
['C++', 'Java', 'Python3']