We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0366401 commit 3677249Copy full SHA for 3677249
kotlin/0938-range-sum-of-bst.kt
@@ -0,0 +1,11 @@
1
+class Solution {
2
+ fun rangeSumBST(root: TreeNode?, low: Int, high: Int): Int {
3
+ root?: return 0
4
+
5
+ return if (root.`val` > high) rangeSumBST(root.left, low, high)
6
+ else if (root.`val` < low) rangeSumBST(root.right, low, high)
7
+ else root.`val` +
8
+ rangeSumBST(root.left, low, high) +
9
+ rangeSumBST(root.right, low, high)
10
+ }
11
+}
0 commit comments