Enlarge BST
Given a binary search tree root
, replace every node’s value v
by its value plus the sum of all other values in the tree that are greater than v
.
Constraints
n ≤ 100,000
wheren
is the number of nodes inroot
https://binarysearch.com/problems/Enlarge-BST
Examples
Example 1
Input
- root =
Output
- answer =
Leave a comment