chirag_h's blog

By chirag_h, history, 3 years ago, In English

I was trying this problem Taklu Kuddus.

The problem gives us a string S and a pattern P and for Q queries we have to find the maximum number of non-overlapping occurrences of P in the substring of S of the given range in q.

I first tried brute force which got TLE. I tried playing with the starting and ending indexes of matched substrings but could not think of a clear strategy.

Any leads on how to approach this?

Full text and comments »

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