3841. Palindromic Path Queries in a Tree
You are given an undirected tree with
nnodes labeled 0 ton - 1. This is represented by a 2D arrayedgesof lengthn - 1, whereedges[i] = [u_i, v_i]indicates an undirected edge between nodesu_iandv_i.You are also given a string
sof lengthnconsisting of lowercase English letters, wheres[i]represents the character assigned to nodei.You are also given a string array
queries, where eachqueries[i]is either:
"update u_i c": Change the character at nodeu_itoc. Formally, updates[u_i] = c."query u_i v_i": Determine whether the string formed by the characters on the unique path fromu_itov_i(inclusive) can be rearranged into a palindrome.Return a boolean array
answer, whereanswer[j]istrueif thej^thquery of type"query u_i v_i"can be rearranged into a palindrome, andfalseotherwise.