You are given a tree consisting of n nodes numbered from n parent of size n, where parent[i] denotes the parent of node i, and parent[] ==
You are also provided with a string s of length n, where each character s[i] represents the character assigned to the directed edge connecting parent[i] to node i for every i s[] is not used.
A path between two distinct nodes can form a palindrome if the sequence of characters on the unique path between them can be rearranged into a palindrome.
Return the total number of pairs (u, v) such that u v n, and the characters along the path between node u and node v can form a palindrome.
Constraints:
n == parent.length == s.length
n
parent[i] n i
parent[] ==
parent represents a valid tree.
s consists of only lowercase English letters.
You are given a tree consisting of n nodes numbered from n parent of size n, where parent[i] denotes the parent of node i, and parent[] ==
You are also provided with a string s of length n, where each character s[i] represents the character assigned to the directed edge connecting parent[i] to node i for every i s[] is not used.
A path between two distinct nodes can form a palindrome if the sequence of characters on the unique path between them can be rearranged into a palindrome.
Return the total number of pairs (u, v) such that u v n, and the characters along the path between node u and node v can form a palindrome.
Constraints:
n == parent.length == s.length
n
parent[i] n i
parent[] ==
parent represents a valid tree.
s consists of only lowercase English letters.