10034. Palindrome Rearrangement Queries
You are given a 0-indexed string
shaving an even lengthn.You are also given a 0-indexed 2D integer array,
queries, wherequeries[i] = [ai, bi, ci, di].For each query
i, you are allowed to perform the following operations:
- Rearrange the characters within the substring
s[ai:bi], where0 <= ai <= bi < n / 2.- Rearrange the characters within the substring
s[ci:di], wheren / 2 <= ci <= di < n.For each query, your task is to determine whether it is possible to make
sa palindrome by performing the operations.Each query is answered independently of the others.
Return a 0-indexed array
answer, whereanswer[i] == trueif it is possible to makesa palindrome by performing operations specified by theithquery, andfalseotherwise.
- A substring is a contiguous sequence of characters within a string.
s[x:y]represents the substring consisting of characters from the indexxto indexyins, both inclusive.