Maximum Connected Cities of Same Color
Filed under Navi
The question
Given cities numbered 1 to N connected via bidirectional roads forming a tree structure, where each city is painted with one of K colors, find the maximum number of same-colored cities you can visit continuously starting from anywhere.
No write-up yet. Related questions below have one.
Related Navi questions
Collected from public candidate posts and coding forums. Updated Nov 2026.