how to solve 149 E

Правка en1, от priojeet_priyom, 2018-08-20 19:25:29

Tried solving 149 E Martian Strings using z-algo. my approach is: compute z index for pattern$text and reverse(pattern)$reverse(text). then find the minimum index for each prefix length match and find the maximum suffix length match indexes for all i (0<=i<length(pattern). the complexity of my code is approx O(m*n). getting TLE. tried optimizing a lot but no luck till now, also tried reading others code but could make sense out of those. my code: submission link

Теги #149 e, #106 (div. 2), #zalgorithm

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский priojeet_priyom 2018-08-20 20:59:34 8 Tiny change: 'compute z index for patte' -> 'compute z value for patte'
en2 Английский priojeet_priyom 2018-08-20 19:27:49 55 (published)
en1 Английский priojeet_priyom 2018-08-20 19:25:29 590 Initial revision (saved to drafts)