JavaScript 2 solutions, easy to understand, beats 100%
Sum while recursing through the tree\n\nvar rangeSumBST = function(root, L, R) {\n    // base case\n    if(root == null) {\n        return 0;\n    }\n    \n    
1. Sum while recursing through the tree\n```\nvar rangeSumBST = function(root, L, R) {\n    // base case\n    if(root == null) {\n        return 0;\n    }\n    \n    if(root.val > R) {\n        return rangeSumBST(root.left, L, R);\n    } else if(root.val < L) {\n        return rangeSumBST(root.right, L, R);\n    } else {\n        return root.val + rangeSumBST(root.left, L, R) + rangeSumBST(root.right, L, R);\n    }\n};\n```\n\n2. Do inorder traversal to get all nodes on tree in order, and then sum all values >= L and <=R. This is less efficient than previous solution because we are traversing all nodes, but this can be easier to understand.\n```\nvar rangeSumBST = function(root, L, R) {\n    var arr = [], sum=0;\n    inorder(root, arr);\n    \n    for(var i=0; i<arr.length; i++) {\n        if(arr[i] >= L && arr[i] <= R) {\n            sum = sum + arr[i];\n        }\n    }\n    \n    return sum;\n};\n\nvar inorder = function(root, arr) {\n    if(root == null) {\n        return;\n    }\n    \n    inorder(root.left, arr);\n    arr.push(root.val);\n    inorder(root.right, arr);\n \n    return;\n}\n```
[]