Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use topological sort.
let dp[u][c] := the maximum count of vertices with color c of any path starting from vertex u. (by JerryJin2905)
Solve with full IDE support and test cases