text of lowercase English letters and a list of queries queries, where queries[i] = [left, right, k].
For each query, take the piece text[left..right] (inclusive). You may rearrange its letters in any order and then replace at most k of them with any lowercase English letters. The answer to the query is True if this can produce a palindrome, and False otherwise.
Queries are independent: the original string never changes. Each replacement changes exactly one letter. Return the answers in the order of the queries.text="racecar", queries=[[0, 6, 0], [1, 3, 0], [1, 3, 1], [2, 5, 1]] → [True, False, True, True]
"racecar" is already a palindrome. "ace" cannot be rearranged into one without replacing anything, but one replacement is enough ("aca", say). "ceca" rearranges into "caac" with no replacement at all.
text="xyzw", queries=[[0, 3, 1], [0, 3, 2], [2, 2, 0]] → [False, True, True]
"xyzw" has four different letters: one replacement is not enough, two are ("xyyx"). A single letter "z" is a palindrome.
text consists of lowercase English letterstext="racecar", queries=[[0, 6, 0], [1, 3, 0], [1, 3, 1], [2, 5, 1]]
[True, False, True, True]
Run checks the first 3 tests in your browser. Submit checks all 95 tests on the server, hidden ones included.