You are given a rooted tree with parent of size parent[i] is the parent of node parent[0]
Additionally, you are provided a string s of length s[i] represents the character assigned to node
Your task is to find the length of the longest path in the tree where no two consecutive nodes on the path share the same character. Return the length of this path.
Constraints:
parent.length s.length
parent[i]
parent[0]
parent represents a valid tree.
s consists of only lowercase English letters.
You are given a rooted tree with parent of size parent[i] is the parent of node parent[0]
Additionally, you are provided a string s of length s[i] represents the character assigned to node
Your task is to find the length of the longest path in the tree where no two consecutive nodes on the path share the same character. Return the length of this path.
Constraints:
parent.length s.length
parent[i]
parent[0]
parent represents a valid tree.
s consists of only lowercase English letters.