How to find the maximum number of non-overlapping occurances of a given substring.

Правка en1, от chirag_h, 2021-06-07 12:43:48

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?

Теги #string matching, #string

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский chirag_h 2021-06-07 12:43:48 550 Initial revision (published)