How to solve Rich Substring(RICHSTR) from August 19 Cook-Off?

Sorry bro but I disagree with all your statements.

  1. r-l < 2 is correct because it’s inclusive. So if l = 2 and r = 4, it should pass as S[2]…S[4] is a valid substring of length 3.
  2. It doesn’t access out of bound and all elements are covered in this loop too.
  3. It runs in time, but gets a WA. Complexity is not the issue here I guess, it’s the logic.

it should be r-l+1
// 20 char

https://www.codechef.com/viewsolution/26005353

Read from line 328 …

1 Like

:stuck_out_tongue: Finally you will be 4 stars then? XD

Dammmn some people be carrying sick templates :100:

1 Like

Kabhi bhi kuch bhi kaam aajataa hai…:joy::joy:

1 Like

:joy::joy::joy::joy:
too many templates…

Yes first point is wrong. Sorry for that.

Second one is misleading too. I should sleep now xD I meant you can miss last two index check for this loop.

Third applies when WA will not come. Consider a string like abcdef…xyzabcd…xyzaa and every query from 1 to 10^5

1 Like