leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
0700.cpp (282B)
0 class Solution {
1 public:
2 TreeNode *searchBST(TreeNode *root, int val) {
3 while (root && root->val != val) {
4 if (val < root->val)
5 root = root->left;
6 else
7 root = root->right;
8 }
9 return root;
10 }
11 };