108. Convert Sorted Array to Binary Search Tree | LEETCODE EASY | TREE | CODE EXPLAINER

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

thanks bhaiya ...your handwriting makes the solution easier to understand and grasp😍

bhaveshjhawar
Автор

Big Fan of You, your channel deserves more subscribers

surajitroy_roll-
Автор

Please make more leetcode hard problems atleast hards in top 400 problems in leetcode

watchlistsclips
Автор

class Solution {
public:
TreeNode* fun(vector<int>& nums, int low, int high)
{
if(low>high)
return NULL;
int mid=(low+high)/2;
TreeNode* root=new TreeNode(nums[mid]);
root->left=fun(nums, low, mid-1);
root->right=fun(nums, mid+1, high);
return root;
}
TreeNode* sortedArrayToBST(vector<int>& nums) {
int low=0, high=nums.size()-1;
return fun(nums, low, high);
}
};

surajitroy_roll-