Problem 1973 · Medium

Count Nodes Equal to Sum of Descendants

Count tree nodes whose value equals the sum of all values in their subtree below them. The visual computes subtree sums bottom-up and marks the matching nodes.

Open the interactive visualisation