Solution: Longest Path With Different Adjacent Characters
Understand how to apply topological sorting to a tree to find the longest path with distinct adjacent characters. Explore tracking longest chains from child nodes and combining them at parent nodes to calculate the overall longest valid path.
We'll cover the following...
We'll cover the following...
Statement
You are given a rooted tree with parent of size parent[i] is the parent of node