로딩
요청 처리 중입니다...

JAVA_LeetCode 98_Validate Binary Search Tree

 JAVA_LeetCode 98_Validate Binary Search Tree

JAVA_LeetCode 98_Validate Binary Search Tree 풀이 class Solution { public boolean isValidBST(TreeNode root) { return isVaild(root, null, null); } private boolean isVaild(TreeNode node, Integer low, Integer high) { // BST 조건 맞추기 if(node == null) return true; // 왼쪽 서브트리 구할 때 현재 노드가 상한값, 오른쪽 서브트리 구할 때 현재 노드가 하한값으로 세팅한다. if((low != null && node.val <= low) || (high !

= null && node.val >= high)) return false; return isVaild(node.left, low, node.val) && isVaild(node.right, node.val, high); } } * 출처 http...