Problem 1038 · Medium

Binary Search Tree to Greater Sum Tree

Visit the tree from largest to smallest while keeping a running sum, so each node stores the sum of values at least as large as itself.

Open the interactive visualisation