JAVA_Range Sum of BST_LeetCode 938


JAVA_Range Sum of BST_LeetCode 938

JAVA_Range Sum of BST_LeetCode 938 풀이 class Solution { int sum = 0; public int rangeSumBST(TreeNode root, int low, int high) { if(root == null ) return 0; if(root.val >= low && root.val <= high) this.sum += root.val; if(root.val > low) rangeSumBST(root.left,low,high); if(root.val < high) rangeSumBST(root.right,low,high); return sum; } } * 출처 https://leetcode.com/problems/range-sum-of-bst/ Range Sum of BST - LeetCode Can you solve this real interview question? Range Sum of BST - Given the root no...


#JAVA #JAVA_LeetCode938 #JAVA_RangeSumofBST #JAVA_RangeSumofBST_LeetCode938 #RangeSumofBST_LeetCode938

원문링크 : JAVA_Range Sum of BST_LeetCode 938