Problem 4015 · Medium

Weighted Sum of a Tree

Find each node’s depth from the root, then weight it by how many levels lie at or below its depth.

Open the interactive visualisation