Skip to content

Commit 99c35d1

Browse files
authored
Create main.cpp
1 parent 4783a19 commit 99c35d1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public:
3+
TreeNode* searchBST(TreeNode* root, int value) {
4+
if(root == NULL) return NULL;
5+
6+
if(root -> val == value) return root;
7+
8+
if(root -> val < value) return searchBST(root -> right, value);
9+
else return searchBST(root -> left, value);
10+
11+
return root;
12+
}
13+
};

0 commit comments

Comments
 (0)