blob: 9d06727edf7239bc9f708cd7c0c1ec060e2ce017 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "leetcode.h"
class Solution {
public:
TreeNode *searchBST(TreeNode *root, int val) {
if (root == NULL)
return NULL;
if (root->val == val)
return root;
if (root->val > val)
return searchBST(root->left, val);
return searchBST(root->right, val);
}
};
int main() {}
|