Common problem types: count distinct colors in subtrees. Find the most frequent color in each subtree. Compute XOR of all distinct values in subtrees. These all follow the same pattern: maintain a container per node, merge child containers, add current node's contribution.
The aggregation step changes (count, max, XOR), but the merging stays the same. Once you learn the technique, you can adapt it to many variations.