A simple method for solving this is to find the sum of all greater values for every node. This method would take O(n^2) time.
The method discussed in this article uses the technique of reverse in-order tree traversal of BST which optimizes the problem to be solved in a single traversal.
Approach: In this problem as we could notice that the largest node would remain the same. The value of 2nd largest node = value of largest + value of second largest node. Similarly, the value of nth largest node will be the sum of the n-th node and value of (n-1)th largest node after modification. So if we traverse the tree in descending order and simultaneously update the sum value at every step while adding the value to the root node, the problem would be solved.
Add all greater values to every node in a given BST: https://www.geeksforgeeks.org/add-greater-values-every-node-given-bst/