Remove Subtrees Below a Threshold

Asked at PayPal · Coding Questions · Difficulty: Easy · Last asked Jul 15, 2026

You are given the root of a binary search tree and an integer `threshold`. Remove every node whose value is less than `threshold`. When a node is removed, its whole subtree is removed with it, including descendants whose values are at least `threshold`. Return the root of the pruned tree.

Loading the problem…