ideservebetter's blog

By ideservebetter, history, 3 weeks ago, In English

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.

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it