Range Queries Problem

Revision en1, by ideservebetter, 2025-02-17 16:45:46

Problem Link

You're given a string S consisting of N lowercase English characters. A string is considered good if it can be rearranged to form a palindrome.

There are Q Queries, Each query contains two integers, l and r, representing a range within the string S. For each query, determine the number of good substrings within the inclusive range [l, r].

How can we solve this problem ? The issue im facing is that if [l, r] can be shuffled to be a palindrome, [l + 1, r] not necessarily can be shuffled. Hence not able to precompute some answers.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ideservebetter 2025-02-17 16:45:46 655 Initial revision (published)