Challenge: Trim the Tree Nodes Outside Range
Try solving the problem of trimming the tree nodes which are not in the range of given minimum and maximum numbers.
We'll cover the following
Problem
Given a BST and a range, delete all nodes outside of that range.
Input
A BST and minimum and maximum values.
Output
An updated BST.
Sample input
Range:
min = 3
max = 9
Binary tree:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.