[HELP] Tree problem

Revision en1, by baddestguy, 2020-06-25 14:48:47

Given a tree with n nodes and n-1 edges, each edge has an integer value that maps to a character from A to Z. For each shortest paths between nodes determine if the sequence of characters of edges encountered can be rearranged to to be palindrome. We are required to count the number of pairs of nodes such that their shortest path can be rearranged to palindrome. (1<=n<=10^5) and tree diameter is less than 1000. Any ideas given those constraints?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English baddestguy 2020-06-25 14:48:47 470 Initial revision (published)