jigsaw7's blog

By jigsaw7, history, 5 years ago, In English

I believe that doing competitive programming helps you become a better software engineer. It would be interesting to hear from the community a problem in a real project that has the same flavor as competitive programming problems.

Full text and comments »

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

By jigsaw7, history, 5 years ago, In English

Given 2 strings S1 and S2 consisting of English letters.
For each index i in S1, it is required to find the largest index j >= i such that S1[i..j] is a substring of S2.

For example,
S1 = "acdsuaf"
S2 = "cadsua"
ans = [1, 2, 6, 6, 6, 6, -1].

How to approach this problem in linear time?

Full text and comments »

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