1
var trimBST = function (root, low, high) {
2
if (!root) return null;
3
if (root.val < low) root = trimBST(root.right, low, high);
4
else if (root.val > high) root = trimBST(root.left, low, high);
5
else {
6
root.left = trimBST(root.left, low, high);
7
root.right = trimBST(root.right, low, high);
8
}
9
return root;
10
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0