Without releasing memory

```
TreeNode* trimBST(TreeNode* r, int L, int R) {
if (r) {
if (r->val < L) return trimBST(r->right, L, R);
if (r->val > R) return trimBST(r->left, L, R);
r->left = trimBST(r->left, L, R);
r->right = trimBST(r->right, L, R);
}
return r;
}
```