Problem 3249 · Medium

Count the Number of Good Nodes

Root the tree at node 0. A node is good when all of its child subtrees have the same size. Count the good nodes.

Open the interactive visualisation