Problem 3004 · Medium

Maximum Subtree of the Same Color

Root the tree at node 0 and find the largest complete subtree in which every node has the same colour as the rest.

Open the interactive visualisation