Validate Binary Search Tree Leetcode Recursion 3 line solution

  Рет қаралды 2,541

Code with Alisha

Code with Alisha

Күн бұрын

Пікірлер: 6
@msdhoni5324
@msdhoni5324 Жыл бұрын
Super explanation
@himcooljig1
@himcooljig1 Жыл бұрын
super explanation i was stuck on it for long
@AmanRaj-gy6qv
@AmanRaj-gy6qv 2 жыл бұрын
Great explanation i was just stuck with this weird overflow error, Thanks for the explanation
@mdkashif7808
@mdkashif7808 3 жыл бұрын
Good mam i can understand easy
@Secret_Superstar_Girl
@Secret_Superstar_Girl Жыл бұрын
Ma'am what will be the value of Max in right subtree call...
@aiyappamn326
@aiyappamn326 11 ай бұрын
As new test cases are added change the INT_MIN and INT_MAX class Solution { public: bool checkValidBst(TreeNode* root,long long min,long long max){ if(root==NULL) return true; if(root->valval>=max) { return false; } return checkValidBst(root->left,min,root->val) && checkValidBst(root->right,root->val,max); } bool isValidBST(TreeNode* root) { if(root->left==NULL && root->right==NULL) return true; return checkValidBst(root,LLONG_MIN, LLONG_MAX); } };
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 17 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 20 МЛН
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 11 МЛН
AVL Trees & Rotations (Self-Balancing Binary Search Trees)
20:38
Back To Back SWE
Рет қаралды 352 М.
L52. Recover BST | Correct BST with two nodes swapped
15:56
take U forward
Рет қаралды 134 М.
L46. Check if a tree is a BST or BT | Validate a BST
9:39
take U forward
Рет қаралды 194 М.
Recover Binary Search Tree | Leetcode 99 | BST | Day-19
15:54
Ayushi Sharma
Рет қаралды 5 М.
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,2 МЛН
L50. Binary Search Tree Iterator | BST | O(H) Space
14:00
take U forward
Рет қаралды 150 М.
Delete a node from Binary Search Tree
18:27
mycodeschool
Рет қаралды 1,1 МЛН
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 17 МЛН