ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [못품/릿코드/98. Validate Binary Search Tree]
    카테고리 없음 2023. 3. 29. 12:30
    var isValidBST = function(root, min=null, max=null) {
        if(!root) return true;
        if(min&& root.val<=min.val) return false;
        if(max&& root.val>=max.val) return false;
        return isValidBST(root.left,min,root)&&isValidBST(root.right,root,max)
        
    };

     

Designed by Tistory.