Given a binary search tree and the lowest and highest boundaries as
R, trim the tree so that all its elements lies in [
R] (R >= L). You might need to change the root of the tree, so the result should return the new root of the trimmed binary search tree.
由于对于 Binary search tree 不理解，所以绕了点弯路，要解这道题，必须理解什么是 binary search tree。我们来看一下定义：
A binary search tree is a rooted binary tree, whose internal nodes each store a key (and optionally, an associated value) and each have two distinguished sub-trees, commonly denoted left and right. The tree additionally satisfies the binary search property, which states that the key in each node must be greater than or equal to any key stored in the left sub-tree, and less than or equal to any key stored in the right sub-tree.:287 (The leaves (final nodes) of the tree contain no key and have no structure to distinguish them from one another.