```
def trimBST(self, root, L, R):
def dfs(node):
if not node: return None
node.left = dfs(node.left)
node.right = dfs(node.right)
if node.val < L: return node.right
if node.val > R: return node.left
return node
return dfs(root)
```