text: /**
   * Definition for a binary tree node.
   * struct TreeNode {
   *     int val;
   *     TreeNode *left;
   *     TreeNode *right;
   *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
   *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
   *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
   * };
   */
  class Solution {
  public:
      //OM GAN GANAPATHAYE NAMO NAMAH 
      //JAI SHRI RAM 
      //JAI BAJRANGBALI 
      //AMME NARAYANA, DEVI NARAYANA, LAKSHMI NARAYANA, BHADRE NARAYANA
      TreeNode *construct(vector<int> nums, int l, int r)
      {
          if(r < l)
              return NULL;
          int mid = (l + r)/2;
          TreeNode *root = new TreeNode(nums[mid]);
          if(r == l)
              return root;
          root->left = construct(nums, l, mid-1);
          root->right = construct(nums, mid+1, r);
          return root;
      }
      TreeNode* sortedArrayToBST(vector<int>& nums) {
          int n = nums.size();
          int l = 0, r = n - 1;
          return construct(nums, l, r);
      }
  };
  