The logic is to traverse the tree in reverse order (largest value first) and set node values as the suffix sums of nodes visited.

```
var convertBST = function(root) {
var sum = 0;
const reverse = node => {
if ( !!node ) {
reverse(node.right);
node.val += sum;
sum += node.val - sum;
reverse(node.left);
}
return node;
}
return reverse(root);
};
```