leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0700.cpp (282B)


      1 class Solution {
      2   public:
      3     TreeNode *searchBST(TreeNode *root, int val) {
      4         while (root && root->val != val) {
      5             if (val < root->val)
      6                 root = root->left;
      7             else
      8                 root = root->right;
      9         }
     10         return root;
     11     }
     12 };